I’m trying to persist some mod specific settings for my mod. In a method called from my ready method I have the following code to set up reasonable defaults if its the first time the mod is loaded:
Then later on I have the following code called when the user changes an option:
MyMod.ds.settings.opts = opts
The option is there and can be read elsewhere - until I quit the game and open it again. Then when I try to get the data store again, it’s blank. I was under the impression that GDT just handles persisting the settings itself. Is there more that needs to be done?
If I change settings to data, move the first set of code to an event handler for the game loading, and manually save the game before quitting, then I can get data to persist between game launches, but I’d rather have this data available across all save files.
@PatrickKlug Does this bug still exist? I am asking because I tried to get around the problem of .settings persistence using the following approach, but did not succeed
// Save settings to storage
this.save = function() {
instance.store.settings = tweakMod.settings;
instance.store.data = instance.store.settings;
DataStore.saveSettings();
};
Is there a way to persist .settings data using a workaround or something else? Or did I miss something?
Btw. saving the game using the mentioned approach was also unsuccessful.
I am also finding that anything in “data” does not get nullified if someone starts a new game whilst already playing a game.
So any flag I set in the first game are carried over into the next game, which is very annoying.