mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-02-27 15:23:45 +01:00
Still addressing bug with loading offline progress
This commit is contained in:
@ -720,12 +720,13 @@ var Engine = {
|
|||||||
Engine._lastUpdate = new Date().getTime();
|
Engine._lastUpdate = new Date().getTime();
|
||||||
var lastUpdate = Player.lastUpdate;
|
var lastUpdate = Player.lastUpdate;
|
||||||
var numCyclesOffline = Math.floor((Engine._lastUpdate - lastUpdate) / Engine._idleSpeed);
|
var numCyclesOffline = Math.floor((Engine._lastUpdate - lastUpdate) / Engine._idleSpeed);
|
||||||
Player.lastUpdate = new Date().getTime();
|
|
||||||
|
|
||||||
/* Process offline progress */
|
/* Process offline progress */
|
||||||
processServerGrowth(numCyclesOffline); //Should be done before offline production for scripts
|
processServerGrowth(numCyclesOffline); //Should be done before offline production for scripts
|
||||||
loadAllRunningScripts(); //This also takes care of offline production for those scripts
|
loadAllRunningScripts(); //This also takes care of offline production for those scripts
|
||||||
if (Player.isWorking) {
|
if (Player.isWorking) {
|
||||||
|
console.log("work() called in load() for " + numCyclesOffline * Engine._idleSpeed + " milliseconds");
|
||||||
if (Player.workType == CONSTANTS.WorkTypeFaction) {
|
if (Player.workType == CONSTANTS.WorkTypeFaction) {
|
||||||
Player.workForFaction(numCyclesOffline);
|
Player.workForFaction(numCyclesOffline);
|
||||||
} else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {
|
} else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {
|
||||||
@ -741,6 +742,8 @@ var Engine = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Hacknet Nodes offline progress
|
//Hacknet Nodes offline progress
|
||||||
processAllHacknetNodeEarnings(numCyclesOffline);
|
processAllHacknetNodeEarnings(numCyclesOffline);
|
||||||
|
|
||||||
@ -752,6 +755,7 @@ var Engine = {
|
|||||||
if (Player.totalPlaytime == null) {Player.totalPlaytime = 0;}
|
if (Player.totalPlaytime == null) {Player.totalPlaytime = 0;}
|
||||||
Player.totalPlaytime += time;
|
Player.totalPlaytime += time;
|
||||||
|
|
||||||
|
Player.lastUpdate = Engine._lastUpdate;
|
||||||
Engine.start(); //Run main game loop and Scripts loop
|
Engine.start(); //Run main game loop and Scripts loop
|
||||||
} else {
|
} else {
|
||||||
//No save found, start new game
|
//No save found, start new game
|
||||||
|
Reference in New Issue
Block a user