-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve mod options lifecycle in editors #1425
Conversation
Notably: Don't save while in editor (particularly map editor).
@krzychu124 Is the CI artifact thing still disabled? |
How does that fix the issue? In asset editor that function is not used at all IIRC |
Enabled and rerun builds, we will see if works |
Yup, working again :) |
The asset editor has auto-save interval in map editor. IIRC that will be triggering any mods to save their stuff in to the map (which is essentially a savegame file tagged "Map" instead of "Savegame"). |
If is saving TM:PE options to map in the editor, then a better fix would be to check for public override void OnSaveData() => if (PlayMode) Save(); Note: I have no clue what effect that would have on whatever it is that TM:PE does to store road customisations in the editors. |
I'll check the save loop later to see what is going on |
I suspect the primary cause is the way we currently define defaults in the option fields themselves which means they can be overwritten by previous in-game or in-editor session when doing subsequent load in the same app session. |
Is it ready for review? After looking how it works it seem that should fix the issue |
Was it actually saving options/etc to map in Map Editor? |
Map created in the map editor is like regular save game but running in special mode to limit interactions. Once created, new games created from it becomes detached from the source so any later updates to original map won't affect games that has been already created. |
Should I move the I have no clue how road customisation data gets saved in map/asset editor (ie. stuff we do want storing in the map/asset file) so not sure if it will have unintentional effects. |
Also... should I add something that checks |
If you mean
yes, that might help if the user subscribed to already published maps on workshop
Which other? AFAIK Timed traffic lights could be enabled in the map editor since created "map" is in 99% a regular savegame, but still disabled in asset editor because asset segments/nodes needs to be remapped after creation (asset editor segment/node ids are just the template to mirror settings) and we don't have mapper for TTL |
For `OptionsManager`: - Save only occurs if `PlayMode` - Load will reset to defaults if not loading a savegame
Tweaked how it works - see OP for details. EDIT: Ready for review. |
@krzychu124 any further comments on this? |
I do allow NC options to be stored in map mode so that the when the user loads a map the roads wouldn't change slopes. |
I'm going to test it when I clear my github notification list :) |
Need some additional tweaks as per #1452 (comment) brb |
Just pushed a commit which:
|
Waiting for more review prior to merge. |
Wiki needs an update because features listed in the table below are enabled by default 😉 As of PR, tested scenario, looks like it nicely saves and loads tmpe feature settings, options are not loaded unless I already saved wrong settings with previous version of the mod. Still need to test map save and restore of TTL, just in case if you haven't already. |
Done :)
I've only tested the scenario editor, I've not yet tested map editor. |
Yeah, I already merged in atlas fix from #1451 :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working in map editor and scenario editor, loads and saves all tm:pe features, mod options are not saved 👍 Works as expected in the Asset/intersection editor.
Compiled mod for testing: TMPE.zip
TM:PE mod options should not be persisted while in editors, particularly the map/scenario editor (which are essentially savegames; any user starting new city from them would get unexpected options set = confuses users).
This PR makes the following changes:
Additionally:
Fixes: #1423
Updates: #1452
Updates: #1449
Updates: #959