diff --git a/src/base.ts b/src/base.ts index 5a34bb6..a80d9ff 100644 --- a/src/base.ts +++ b/src/base.ts @@ -165,19 +165,11 @@ function runNextTick(func: Function) { } function ifPaused(whenPaused: () => void, whenUnpaused: () => void) { - var wasPaused = { wasPaused: undefined }; - var oldElapsed = date.ticksElapsed; - context.setTimeout(function() { - if( date.ticksElapsed == oldElapsed ) { - wasPaused.wasPaused = true; - if(whenPaused) - whenPaused(); - } else { - wasPaused.wasPaused = false; - if(whenUnpaused) - whenUnpaused(); - } - }, 100); + var wasPaused = context.paused; + + if(wasPaused) whenPaused(); + else whenUnpaused(); + return wasPaused; } diff --git a/src/gui/archipelagoWindow.ts b/src/gui/archipelagoWindow.ts index 9e0f6aa..786b994 100644 --- a/src/gui/archipelagoWindow.ts +++ b/src/gui/archipelagoWindow.ts @@ -26,13 +26,11 @@ function archipelagoGui(){ archipelago_settings.started = true; saveArchipelagoProgress();//Save the settings to our Archipelago tracker // we need to unpause the game in order for the next tick to run - var wasPaused = UnpauseGame(); + UnpauseGame(); runNextTick(function() { initRando(); - if(wasPaused.wasPaused && global_settings.auto_pause) { - // we know the game is currently unpaused because we're inside a tick event - // so we don't need the fancy PauseGame function - context.executeAction('pausetoggle', {}); + if(global_settings.auto_pause) { + PauseGame(); } createChangesWindow(); }); @@ -115,8 +113,8 @@ function archipelagoLocations(){ var Archipelago = GetModule("RCTRArchipelago") as RCTRArchipelago; var messageLog = context.getParkStorage().get("RCTRando.MessageLog") as Array; - var game_choice = ["Ocarina of Time", "Adventure", "Donkey Kong Country 3", "Final Fantasy 1", "Hollow Knight", - "The Legend of Zelda", "A Link to the Past", "Links Awakening", "Pokemon Red and Blue", "Rogue Legacy", + var game_choice = ["Ocarina of Time", "Adventure", "Donkey Kong Country 3", "Final Fantasy 1", "Hollow Knight", + "The Legend of Zelda", "A Link to the Past", "Links Awakening", "Pokemon Red and Blue", "Rogue Legacy", "Sonic Adventure 2", "Super Mario World", "Super Mario 64", "Super Metroid", "VVVVVV"]; var game = game_choice[Math.floor(Math.random() * game_choice.length)];//Gotta throw that shade diff --git a/src/gui/newGameWindow.ts b/src/gui/newGameWindow.ts index 4bc9473..9290710 100644 --- a/src/gui/newGameWindow.ts +++ b/src/gui/newGameWindow.ts @@ -38,13 +38,11 @@ function startGameGui() { settings.num_months_cycle = randoCycles[cycle['text']]; // we need to unpause the game in order for the next tick to run - var wasPaused = UnpauseGame(); + UnpauseGame(); runNextTick(function() { initRando(); - if(wasPaused.wasPaused && global_settings.auto_pause) { - // we know the game is currently unpaused because we're inside a tick event - // so we don't need the fancy PauseGame function - context.executeAction('pausetoggle', {}); + if(global_settings.auto_pause) { + PauseGame(); } createChangesWindow(); }); diff --git a/src/rctrando_init.ts b/src/rctrando_init.ts index f82bd02..a88fa34 100644 --- a/src/rctrando_init.ts +++ b/src/rctrando_init.ts @@ -25,7 +25,7 @@ let initedMenuItems:boolean = false; let subscriptions = [] const minApiVersion = 52;// or 60? -const targetApiVersion = 77;// v0.4.5 +const targetApiVersion = 84;// v0.4.11 info(" \n"+rando_name+" v"+rando_version + ", OpenRCT2 API version "+context.apiVersion+', minimum required API version is '+minApiVersion+', recommended API version is '+targetApiVersion + ', network.mode: '+network.mode+', context.mode: '+context.mode