Add saving of cheats#7088
Conversation
|
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. |
| if (version > 2) | ||
| { | ||
| instance.SavedCheats = reader.ReadObject<CheatManagerState>(); | ||
| CheatManager.RestoreState(instance.SavedCheats); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
And this is also an unsafe assumption, so again the save capturing code should snapshot the cheats when it starts to make a save.
|
|
||
| public static void OnEnteringGame(bool cheatsUsed, bool freebuild) | ||
| { | ||
| CheatManager.OnCheatsDisabled(); |
There was a problem hiding this comment.
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.
I occasionally run into this when testing some niche cases, but that's quite limited. |
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 |
|
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. |
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.
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.
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.