From dcdabf71ef00f98f2ecfc6d951e1776a41259e79 Mon Sep 17 00:00:00 2001 From: Moka Date: Sun, 27 Oct 2024 16:23:19 +0100 Subject: [PATCH] Fix manifest being used before the game is initialized --- src/main.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index d25ff08222d..993bd1018ae 100644 --- a/src/main.ts +++ b/src/main.ts @@ -44,7 +44,7 @@ document.fonts.load("16px emerald").then(() => document.fonts.load("10px pkmnems let game; -const startGame = async () => { +const startGame = async (manifest?: any) => { await initI18n(); const LoadingScene = (await import("./loading-scene")).LoadingScene; const BattleScene = (await import("./battle-scene")).default; @@ -94,16 +94,18 @@ const startGame = async () => { version: version }); game.sound.pauseOnBlur = false; + if (manifest) { + game["manifest"] = manifest; + } }; fetch("/manifest.json") .then(res => res.json()) .then(jsonResponse => { - startGame(); - game["manifest"] = jsonResponse.manifest; + startGame(jsonResponse.manifest); }).catch(() => { // Manifest not found (likely local build) - // startGame(); + startGame(); }); export default game;