diff --git a/README.md b/README.md index f63699757..3e23bb695 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/Script.js b/src/Script.js index e0c6b7301..ec88fd77b 100644 --- a/src/Script.js +++ b/src/Script.js @@ -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); + } + } } \ No newline at end of file diff --git a/src/engine.js b/src/engine.js index 7b63a1ba0..71fa6ed35 100644 --- a/src/engine.js +++ b/src/engine.js @@ -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");