Upon opening window, all of the running scripts are loaded into WorkerScripts

This commit is contained in:
Daniel Xie 2016-12-14 15:22:12 -06:00
parent 23c036827f
commit 334c144bae
3 changed files with 8 additions and 4 deletions

@ -10,10 +10,9 @@ TESTING TODO:
Script RAM Usage and corresponding terminal commands
If a server has no more money available it cannot be hacked anymore
Should work automatically...because your money gained percentage will be multiplied by 0
When the game is loaded re-load all of the scripts in runningScripts
Tasks TODO:
Script offline progress
When the game is loaded re-load all of the scripts in runningScripts
If a script has bad syntax...it fucks everything up when you try to run it so fix that
Scroll all the way down when something is post()ed
Scripts tab that shows script stats

@ -127,9 +127,13 @@ Script.fromJSON = function(value) {
Reviver.constructors.Script = Script;
//TODO
//Called when the game is loaded. Loads all running scripts (from all servers)
//into worker scripts so that they will start running
function loadAllRunningScripts() {
for (var i = 0; i < AllServers.length; i++) {
var server = AllServers[i];
for (var j = 0; j < server.runningScripts.length; j++) {
addWorkerScript(server.runningScripts[j], server);
}
}
}

@ -247,6 +247,7 @@ var Engine = {
console.log("Loaded game from save");
Companies.init();
CompanyPositions.init();
loadAllRunningScripts();
} else {
//No save found, start new game
console.log("Initializing new game");