diff --git a/src/game/events.ts b/src/game/events.ts index 78219fd..3be00b7 100644 --- a/src/game/events.ts +++ b/src/game/events.ts @@ -45,6 +45,11 @@ export interface GlobalEvents { * @param vue The Vue App being constructed. */ setupVue: (vue: App) => void; + /** + * Sent whenever a save has finished loading. + * Happens when the page is opened and upon switching saves in the saves manager. + */ + onLoad: VoidFunction; } /** A global event bus for hooking into {@link GlobalEvents}. */ diff --git a/src/util/save.ts b/src/util/save.ts index c5a0073..4138e17 100644 --- a/src/util/save.ts +++ b/src/util/save.ts @@ -1,4 +1,5 @@ import projInfo from "data/projInfo.json"; +import { globalBus } from "game/events"; import type { Player, PlayerData } from "game/player"; import player, { stringifySave } from "game/player"; import settings, { loadSettings } from "game/settings"; @@ -112,6 +113,8 @@ export async function loadSave(playerObj: Partial): Promise { Object.assign(player, playerObj); settings.active = player.id; + + globalBus.emit("onLoad"); } setInterval(() => {