[ANSWERED] How do I code per-world mod settings?

Started by ww9, February 14, 2019, 01:04:57 PM

Previous topic - Next topic

ww9

I've successfully coded settings for my mod with the following structure:

public class Settings : ModSettings
{
public override void ExposeData() {}
public void DoSettingsWindowContents(Rect settingRect) {}
public string SettingsCategory() {}
}


The settings are saved to a file in .../Ludeon Studios/RimWorld by Ludeon Studios/Config/MyMod.xml and is used for all worlds, old and new.

Now I'd like to also offer per-save settings. I remember seeing a mod that offered both per-save and global settings but I can't recall which mod was it.

Does anyone know a mod that has both per-world and global settings? Or knows how to implement per-save mod settings?

Thanks!

ww9

I got the answer from the the kind folks at #mod-development in Discord:

Make my own GameComponent and override ExposeData().

@Mehni has been writing top tier modding articles, this is the one pertinent to my question: https://rimworldwiki.com/wiki/Modding_Tutorials/GameComponent