mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
Added some TODOs
This commit is contained in:
parent
867ae191b5
commit
2d41a63707
@ -1,13 +1,16 @@
|
||||
/* Worker code, contains Netscript scripts that are actually running */
|
||||
//TODO Need some way to stop scripts. Idea: Put a flag in the environment, we can setActive
|
||||
//this flag from outside. If the evaluate() function sees that flag it rejects the current
|
||||
// Promise. We can catch that rejection and stop the script.
|
||||
|
||||
/* Actual Worker Code */
|
||||
function WorkerScript() {
|
||||
this.name = "";
|
||||
this.running = false;
|
||||
this.server = null;
|
||||
this.code = "";
|
||||
this.env = new Environment();
|
||||
this.timeout = null;
|
||||
this.name = "";
|
||||
this.running = false;
|
||||
this.serverHostname = null;
|
||||
this.code = "";
|
||||
this.env = new Environment();
|
||||
this.timeout = null;
|
||||
}
|
||||
|
||||
//Array containing all scripts that are running across all servers, to easily run them all
|
||||
@ -23,8 +26,8 @@ function runScriptsLoop() {
|
||||
console.log("AST of new script:");
|
||||
console.log(ast);
|
||||
|
||||
evaluate(ast, workerScripts[i]);
|
||||
workerScripts[i].running = true;
|
||||
evaluate(ast, workerScripts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
//Netburner Server class
|
||||
//TODO Make a map of all IPS in the game so far so that we don't accidentally
|
||||
// get duplicate IPs..however unlikely it is
|
||||
function Server() {
|
||||
/* Properties */
|
||||
//Connection information
|
||||
@ -18,7 +20,7 @@ function Server() {
|
||||
this.cpuSpeed = 1; //MHz
|
||||
|
||||
this.scripts = [];
|
||||
this.runningScripts = []; //Names of scripts currently being run
|
||||
this.runningScripts = []; //Names (and only names) of scripts being run
|
||||
this.programs = [];
|
||||
|
||||
/* Hacking information (only valid for "foreign" aka non-purchased servers) */
|
||||
|
@ -434,10 +434,16 @@ var Terminal = {
|
||||
if (Player.currentServer.hasAdminRights == false) {
|
||||
post("Need root access to run script");
|
||||
} else {
|
||||
//TODO Run script here
|
||||
var filename = Player.currentServer.scripts[i].filename;
|
||||
|
||||
//Add to current server's runningScripts
|
||||
Player.currentServer.runningScripts.push(filename)
|
||||
|
||||
//Create WorkerScript
|
||||
var s = new WorkerScript();
|
||||
s.name = Player.currentServer.scripts[i].filename;
|
||||
s.code = Player.currentServer.scripts[i].code;
|
||||
s.name = filename;
|
||||
s.code = Player.currentServer.scripts[i].code;
|
||||
s.hostname = Player.currentServer.hostname;
|
||||
workerScripts.push(s);
|
||||
console.log("Pushed script onto workerScripts");
|
||||
return;
|
||||
|
@ -1,3 +1,6 @@
|
||||
//TODO Saving only works with stirngs.key value pairs. Think of a system to do saves
|
||||
// And everything with all the things I have
|
||||
|
||||
//Replaces the character at an index with a new character
|
||||
String.prototype.replaceAt=function(index, character) {
|
||||
return this.substr(0, index) + character + this.substr(index+character.length);
|
||||
|
Loading…
Reference in New Issue
Block a user