Add real autosave (per-item) + New Game / Continue menu #50
Loading…
Reference in a new issue
No description provided.
Delete branch "task/49-autosave-continue"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #49
GameProgress only saved current_area_path on area completion - quitting mid-area lost all placed-item progress. Adds per-item autosave (game_progress.gd tracks placed_items keyed by area + item name, saved on every single placement change via area.gd) and restores already-placed items on scene load via a new item.gd restore_placed(). main_menu.tscn's Play button is split into New Game (wipes progress) and Continue (resumes exactly where you left off, disabled on a first-ever launch with no save).
Validated headlessly via a disposable hook in area.gd driving 3 phases across real reload_current_scene() calls (reverted before commit): place-then-reload restores the right items at the right slots without touching the rest; New Game + reload comes back clean. Also confirmed ContinueButton.disabled tracks has_existing_save() in both states.
🤖 Generated with Claude Code
GameProgress only ever saved current_area_path, and only on area completion - quitting partway through placing the Armory's 47 items lost all of that progress. game_progress.gd now also tracks placed_items (area_scene_path -> {item_name: true}), with set_item_placed()/is_item_placed() as the real autosave: area.gd calls set_item_placed() on every single item placement/un-placement, not just area completion, and restores any already-placed items on _ready() via a new item.gd restore_placed() (factored out of try_snap()'s stand-lookup/slot-math so both share the same logic). Old save files just won't have the new key and keep loading fine with no items pre-placed. main_menu.tscn's single Play button is now New Game (wipes progress via GameProgress.start_new_game()) and Continue (resumes exactly where you left off - disabled via has_existing_save() on a first-ever launch). No save-on-quit hook needed anywhere, including the pause menu - every placement already autosaves immediately. Validated headlessly via a disposable hook in area.gd driving 3 phases across real reload_current_scene() calls (reverted before this commit): placing 2 swords persists to user://save.json and is_item_placed(); reloading restores those two as placed/frozen at the right slot while a third stays on the floor, with placed_count/win state correct; start_new_game() + reload comes back with nothing placed. Also confirmed ContinueButton.disabled tracks has_existing_save() correctly with and without a save file present. Closes #49 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>