mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-23 01:32:55 +02:00
V0.35.0. Adding netscript_tests in game testbench.
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import {HacknetNode} from "./HacknetNode.js";
|
||||
import {NetscriptFunctions} from "./NetscriptFunctions.js";
|
||||
import {NetscriptPort} from "./NetscriptPort.js";
|
||||
|
||||
/* Environment
|
||||
* NetScript program environment
|
||||
*/
|
||||
@@ -73,6 +76,14 @@ Environment.prototype = {
|
||||
}
|
||||
res = res[i];
|
||||
}
|
||||
|
||||
//Cant assign to ports or HacknetNodes
|
||||
if (res[idx[idx.length-1]] instanceof HacknetNode) {
|
||||
throw new Error("Cannot assign a Hacknet Node handle to a new value");
|
||||
}
|
||||
if (res[idx[idx.length-1]] instanceof NetscriptPort) {
|
||||
throw new Error("Cannot assign a Netscript Port handle to a new value");
|
||||
}
|
||||
return res[idx[idx.length-1]] = value;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user