So I’m pretty sure I’ve figured out how to do this using user_settings.json, but I was hoping I could save mod-specific settings somewhere else so I’m not cluttering up that file, especially if I want to easily just clear out all the settings for my mod. Can I access a settings.json specifically for my mod?
(One way I could probably technically achieve this outside of user_settings.json involves encoding my data into a building template, but that seems a little messy…)
You could use radiant.mods.write_object()
and radiant.mods.read_object()
, but user_settings.json
is really the right place to save user-configurable settings.
And then if I wanted to do client-map-based, I’d want to configure my settings object something like the following?
settings {
“[savegame-id]” : {
“setting1” : “value1”,
“setting2” : “value2”
}
Or could/should I create some sort of object in the savegame for that? This situation is sort of like WoW UI mods having global settings but also having server/character-specific settings.
You could do something like generate a unique ID when the mod is first loaded, and use that to identify which savegame/city you are in on subsequent loads.
There’s also some support for client state that gets saved to the server (ClientState:set_browser_data()
), but I don’t think anything actually uses it, so it might not work or might have undiscovered bugs.