V0.35.0. Adding netscript_tests in game testbench.

This commit is contained in:
danielyxie
2018-03-03 15:05:33 -06:00
parent 271932b287
commit e3c435270b
57 changed files with 4621 additions and 2581 deletions
+11
View File
@@ -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;
},