Skip to content

Add saving of cheats#7088

Open
Patryk26g wants to merge 2 commits into
masterfrom
cheats-saving
Open

Add saving of cheats#7088
Patryk26g wants to merge 2 commits into
masterfrom
cheats-saving

Conversation

@Patryk26g

@Patryk26g Patryk26g commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Brief Description of What This PR Does

Cheats are now saved in the game saves

Progress Checklist

Note: before starting this checklist the PR should be marked as non-draft.

  • PR author has checked that this PR works as intended and doesn't
    break existing features:
    https://wiki.revolutionarygamesstudio.com/wiki/Testing_Checklist
    (this is important as to not waste the time of Thrive team
    members reviewing this PR). This includes gameplay testing by the PR author.
  • Initial code review passed (this and further items should not be checked by the PR author)
  • Functionality is confirmed working by another person (see above checklist link)
  • Final code review is passed and code conforms to the
    styleguide.

Before merging all CI jobs should finish on this PR without errors, if
there are automatically detected style issues they should be fixed by
the PR author. Merging must follow our
styleguide.

@github-project-automation github-project-automation Bot moved this to In progress in Thrive Planning Jul 12, 2026
@Patryk26g
Patryk26g marked this pull request as ready for review July 12, 2026 19:55
@hhyyrylainen

Copy link
Copy Markdown
Member

I'm not sure if this is actually the wanted behaviour? Like if you load a save someone gave you it might have cheats on and you don't realize why the gameplay is different...

If this feature is desired, then I think I can accept it but I'd like to have an option in the settings menu to override this feature and not load cheats from a save file.

@hhyyrylainen hhyyrylainen added this to the Release 1.2.0 milestone Jul 15, 2026
if (version > 2)
{
instance.SavedCheats = reader.ReadObject<CheatManagerState>();
CheatManager.RestoreState(instance.SavedCheats);

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.

This shouldn't apply here, there are situations to load a save's data without immediately loading it. So the cheats state should be reapplied in InProgressLoad I think.


writer.WriteObject(ThriveopediaData);

SavedCheats = CheatManager.CaptureState();

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.

And this is also an unsafe assumption, so again the save capturing code should snapshot the cheats when it starts to make a save.

Comment thread src/general/MainMenu.cs

public static void OnEnteringGame(bool cheatsUsed, bool freebuild)
{
CheatManager.OnCheatsDisabled();

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.

I think this is not safe to remove... at least I expect there to be a chance to "smuggle" cheat state into a save without getting marked as having cheated in the game.

@Accidental-Explorer

Copy link
Copy Markdown
Contributor

I'm not sure if this is actually the wanted behaviour? Like if you load a save someone gave you it might have cheats on and you don't realize why the gameplay is different...

I occasionally run into this when testing some niche cases, but that's quite limited.

@Patryk26g

Copy link
Copy Markdown
Contributor Author

I'm not sure if this is actually the wanted behaviour? Like if you load a save someone gave you it might have cheats on and you don't realize why the gameplay is different...

If this feature is desired, then I think I can accept it but I'd like to have an option in the settings menu to override this feature and not load cheats from a save file.

Makes sense, I will put it behind an option.

The reason for this is PR is that it was very frustrating for me when testing stuff - for example MP cost when the cheat for infinite MP was turned on, the game saved and reloaded for testing - I would need to turn that cheat on every time

@hhyyrylainen

Copy link
Copy Markdown
Member

One thing we could do now with the in-game console is making all cheats available through it and implementing an "autorun" system that allows you to basically make a text file with console commands that run automatically each time. That could help a lot with automating setup when testing something, for example loading a save with a specific name and then triggering specific cheats.

But yeah, I think this is also a fine enough feature to have but I'd like a way to opt out.

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

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants