Hotfix crash when attempting to simulate time while gameLoop is frozen

This commit is contained in:
SpectralFlame 2023-05-25 18:36:38 -05:00
parent 82e35675ee
commit 57a369c69f

View File

@ -396,6 +396,14 @@ export function gameLoop(passDiff, options = {}) {
EventHub.dispatch(GAME_EVENT.GAME_TICK_BEFORE); EventHub.dispatch(GAME_EVENT.GAME_TICK_BEFORE);
// In certain cases we want to allow the player to interact with the game's settings and tabs, but prevent any actual
// resource generation from happening - in these cases, we have to make sure this all comes before the hibernation
// check or else it'll attempt to run the game anyway
if (Speedrun.isPausedAtStart() || GameEnd.creditsEverClosed) {
GameUI.update();
return;
}
let diff = passDiff; let diff = passDiff;
const thisUpdate = Date.now(); const thisUpdate = Date.now();
const realDiff = diff === undefined const realDiff = diff === undefined
@ -411,18 +419,6 @@ export function gameLoop(passDiff, options = {}) {
simulateTime(realDiff / 1000, true); simulateTime(realDiff / 1000, true);
} }
if (GameEnd.creditsEverClosed) {
GameUI.update();
return;
}
// We want to allow for a speedrunner to be able to adjust their visual settings before actually starting the run,
// which means that we need to effectively halt the game loop until the official start
if (Speedrun.isPausedAtStart()) {
GameUI.update();
return;
}
// Ra memory generation bypasses stored real time, but memory chunk generation is disabled when storing real time. // Ra memory generation bypasses stored real time, but memory chunk generation is disabled when storing real time.
// This is in order to prevent players from using time inside of Ra's reality for amplification as well // This is in order to prevent players from using time inside of Ra's reality for amplification as well
Ra.memoryTick(realDiff, !Enslaved.isStoringRealTime); Ra.memoryTick(realDiff, !Enslaved.isStoringRealTime);