Skip to content

Prevent saving during the tutorial - #700

Open
BenjaminAmos wants to merge 1 commit into
MovingBlocks:developfrom
BenjaminAmos:tutorial-save-fixes
Open

Prevent saving during the tutorial#700
BenjaminAmos wants to merge 1 commit into
MovingBlocks:developfrom
BenjaminAmos:tutorial-save-fixes

Conversation

@BenjaminAmos

Copy link
Copy Markdown
Contributor

Description

This pull request attempts to fix areas where the game still saves whilst the tutorial is active. This is only a temporary solution and changes to SaveManager may provide a more comprehensive one in the future.

Testing

  • Start a new game
  • Buy an item
  • Exit to the main menu
  • Start the tutorial
  • Exit the tutorial
  • Continue your last game
  • The item you bought previously, along with your last save data, should be present

This should fix #699.

@NicholasBatesNZ NicholasBatesNZ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, and sorry it sat for so long — it's still needed, #699 is open and I confirmed the autosave timer still overwrites the real save the moment the tutorial starts. I traced every write path on current develop (writeShips, saveWorld, SerialisationManager.serialise) and with this patch they're all covered, so the coverage side looks complete.

One thing to fix before merge though: in StarPort the && !game.isTutorial() guard also skips setTranscendent() (line 127) and setSolShip() (line 405), not just the save — so a tutorial player who uses a star port ends up detached from their ship, since removeObjDelayed(ship) still runs. Star ports are generated in the tutorial world too and the 200 starting credits cover the 10-credit fare, so it's reachable.

Could you keep the isPlayer() check on the outer if and nest only the SaveManager.saveWorld(...) call inside a !game.isTutorial() check? Happy to merge once that's in — no objection to this being a stopgap ahead of a proper SaveManager fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Starting a tutorial overwrites main game save data

2 participants