mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
Changed the game speed so that it wasn't running faster (Rounding the number of game cycles usually caused it to speed up). Save Load function SHOULD be working now
This commit is contained in:
parent
d5d198cbb4
commit
2fe4e8a19a
@ -71,7 +71,8 @@ function Script() {
|
||||
/* Properties to calculate offline progress. Only applies for infinitely looping scripts */
|
||||
|
||||
//Time it takes to execute one iteration of the entire script
|
||||
//Each function takes 1 second, plus hacking time plus and sleep commands
|
||||
//Each function takes CONSTANTS.CodeInstructionRunTime seconds,
|
||||
//plus hacking time plus and sleep commands
|
||||
this.executionTimeMillis = 0;
|
||||
|
||||
//Number of instructions ("lines") in the code. Any call ending in a ;
|
||||
@ -82,14 +83,6 @@ function Script() {
|
||||
this.serversHacked = [];
|
||||
};
|
||||
|
||||
//Execute the next function in the Script's function queue
|
||||
Script.prototype.executeNext = function() {
|
||||
if (this.functionQueue.length <= 0) {return;}
|
||||
|
||||
//Shift the next element off ths function queue and then execute it
|
||||
(this.functionQueue.shift())();
|
||||
}
|
||||
|
||||
//Get the script data from the Script Editor and save it to the object
|
||||
Script.prototype.saveScript = function() {
|
||||
if (Engine.currentPage == Engine.Page.ScriptEditor) {
|
||||
@ -106,3 +99,13 @@ Script.prototype.saveScript = function() {
|
||||
//TODO Calculate/update number of instructions, ram usage, execution time, etc.
|
||||
}
|
||||
}
|
||||
|
||||
Script.prototype.toJSON = function() {
|
||||
return Generic_toJSON("Script", this);
|
||||
}
|
||||
|
||||
Script.fromJSON = function(value) {
|
||||
return Generic_fromJSON(Script, value.data);
|
||||
}
|
||||
|
||||
Reviver.constructors.Script = Script;
|
@ -152,7 +152,7 @@ var Engine = {
|
||||
var diff = _thisUpdate - Engine._lastUpdate;
|
||||
|
||||
//Divide this by cycle time to determine how many cycles have elapsed since last update
|
||||
diff = Math.round(diff / Engine._idleSpeed);
|
||||
diff = Math.floor(diff / Engine._idleSpeed);
|
||||
|
||||
if (diff > 0) {
|
||||
//Update the game engine by the calculated number of cycles
|
||||
|
Loading…
Reference in New Issue
Block a user