From 6fe843bf5546cb7a21f92f776ecec98fc52124f5 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sun, 23 Feb 2025 22:30:57 -0800 Subject: [PATCH] Save on end-of-day, or after endgame. Putting it here avoids a circular reference problem --- src/hotbar.ts | 2 ++ src/save.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hotbar.ts b/src/hotbar.ts index 612d35f..6ce230a 100644 --- a/src/hotbar.ts +++ b/src/hotbar.ts @@ -6,6 +6,7 @@ import { addButton } from "./button.ts"; import { getPlayerProgress } from "./playerprogress.ts"; import { getStateManager } from "./statemanager.ts"; import { getCheckModal } from "./checkmodal.ts"; +import { saveGame } from "./save.ts"; type Button = { label: string; @@ -112,6 +113,7 @@ export class Hotbar { }, () => { getStateManager().advance(); + saveGame(); }, ); } diff --git a/src/save.ts b/src/save.ts index a0e80d8..ec36afa 100644 --- a/src/save.ts +++ b/src/save.ts @@ -85,7 +85,7 @@ function readBestSave(): SaveFileV1LoadResult { }; } -export function save() { +export function saveGame() { const targetSlot: SaveSlot = readBestSave().slot === "FLEDGLING_SLOT_1" ? "FLEDGLING_SLOT_2"