• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Is there a preferred way to make an SDX mod configurable?

Ghost314

New member
I'm about to release my first mod for 7D2D, which is an SDX mod that repositions zombie corpses just before they fall, in order to prevent them from being immediately destroyed from spawning in a bad location.

I made a standard app.config and .settings file to store and load some settings for things like, how far the algorithm should search for a proper spawn point. Ideally, I want the user to be able to change these settings by altering the files and restarting 7D2D without having to re-build the entire mod.

After building my mod, I can't seem to find the config or settings files anywhere in the game directory, which makes them kind of hard to edit :apthy: . I'm wondering if any one knows what the SDX build tool is doing with those files, or if there is some other standard way for making configurable mods.

 
I think the preferred method is to make a special class, so that in the xml you can add new lines to configure the new options.

 
I think the preferred method is to make a special class, so that in the xml you can add new lines to configure the new options.
So for example, I might define a new type of block that points to my settings class, and have my config options as custom properties on that new block type?

 
So for example, I might define a new type of block that points to my settings class, and have my config options as custom properties on that new block type?
Yes, that's the easiest and most streamline approach. I'm looking at different configuration options that would give us more flexibility, but it's still early in that process.

 
if its a block or entity then adding properties is easy. If you need app wide settings then you might need to make a config xml or json file and read it in yourself

For code to run at the start of the server try something like this:

Code:
class ModConfig : ModScript
{
 private static Dictionary<string,string> params;

 public override void OnGameStarted()
 {
   //load the xml file and parse into the config dictionary here
   //then access the values via the static ModConfig.params.ContainsKey("item1") /  ModConfig.params["item1"] etc.
 }
}
 
Back
Top