Jump to content

[MODDING] There should be a dedicated function for creating a config file


Recommended Posts

Currently when a mod wants a config, the approach tends to be to create a .json file in the same directory as the mod .dll and parse it with:

JsonConvert.DeserializeObject<YourConfigClass>(json);

However, because this file is in the mod folder, it gets replaced whenever the mod is updated, which obviously sucks for the end-user.

 

As an alternative, there should be some dedicated function, such as:

ConfigHelper.getJsonConfig<YourConfigClass>("yourconfigname.json", "yourmodID");

This would read (or create) a .json config file inside a user folder (either "AppData\LocalLow\Klei\Oxygen Not Included\modconfig\yourmodID\yourconfigname.json" or "Documents\Klei\OxygenNotIncluded\modconfig\yourmodID\yourconfigname.json"), making it safe from this issue, as well as simplifying the process of adding configs for new modders. Internally, it would use the JsonConvert function shown above, and could also include a basic compression scheme such as deflate.

Additionally, having a standard function like this would allow modders to hook into the event, should they want to provide extra functionality for managing mods and their settings.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
×
  • Create New...