limoka / DSP-Mods

An example how to add a custom model with your mesh and animations
MIT License
32 stars 11 forks source link

[Enhancement] DSPModSave - Add interface to load mod savedata before loading saves #83

Closed soarqin closed 9 months ago

soarqin commented 9 months ago

https://github.com/kremnev8/DSP-Mods/blob/719e9ed7c0a117395be5f71c71549293a6e0e3d7/Mods/DSPModSave/src/DSPModSave/Patches.cs#L98-L100 Currently there is only Postfix patch for LoadCurrentGame.

I have a mod which is required to use saved options in patched codes during loading saves, so that the Postfix patch is too late in this situation.

limoka commented 9 months ago

This was done specifically so you can apply your saved data to the world. What are you trying to achieve?

soarqin commented 9 months ago

For a simple example: I would like to use mod saved options in my patch to GameData.Import(), the Postfix patch is too late to get the mod data so that I cannot use DSPModSave to manage my saved options.

limoka commented 9 months ago

What kind of data are you storing? Because by the sound of it, simple ConfigFile is all you need.

limoka commented 9 months ago

Also you didn't say WHAT you wanted to achieve. Your last message is too vague on your overaching goals.

soarqin commented 9 months ago

What kind of data are you storing? Because by the sound of it, simple ConfigFile is all you need.

hmmm, in my mod UniverseGenTweaks I want to save universe generation options in game saves, which may differ across new-games, so that they cannot be saved in ConfigFile. These options are used in UniverseGen.CreateGalaxy(), which is called during GameData.Import(), so I need to know these options before gamesave is fully loaded

limoka commented 9 months ago

Hm. I see. I will think about this.

limoka commented 9 months ago

Your request has been implemented in v1.2.0. Place ModSaveSettings attribute on your plugin class like so:

[ModSaveSettings(LoadOrder = LoadOrder.Preload)]