Creating Mod Settings
This guide outlines how to use OWML’s config system to display mod settings in the settings menu.
Editing default-config.json
Section titled “Editing default-config.json”First things first, you’re going to need to define your settings, open up default-config.json, and add an object called settings.
The settings object is comprised of key-value pairs where the key is the ID of the setting and the value is the default value of that setting.
For example, if I wanted a check box called “Party Mode”, I would do:
You can also do other data types like numbers and strings
Complex Settings
Section titled “Complex Settings”Complex settings use JSON objects to allow for more customization. You can use it to add selectors:
And sliders as well:
You can also separate your options with separators:
Getting Values In C#
Section titled “Getting Values In C#”Now that we have these values defined, we can use ModHelper.Config.GetSettingsValue to grab our options.
If you want to listen for changes to your mod’s config, you can override the Configure method. This will be passed the new config data whenever the player edits the setting via the menu.
Config Updates
Section titled “Config Updates”Something important to note is that when the manager pulls and update for your mod, the config.json file is preserved. The issue with this is menus are generated from the config.json file. When changing options like slider minimums and maximums or choices, you may want to create a new property rather than edit an existing one to make sure the UI is correct.
Translations
Section titled “Translations”Mod config options can be translated in the same way that New Horizons mods do translations. First, you need to add a folder named translations in the root directory of your mod.
DirectoryMyMod
- manifest.json
Directorytranslations/
- english.json
- russian.json
- …
There are 12 supported languages in Outer Wilds: english, spanish_la, german, french, italian, polish, portuguese_br, japanese, russian, chinese_simple, korean, and turkish.
In the translations folder you can put json files with the name of the language you want to translate for. This file will contain a single dictionary named UIDictionary which will have key-value pairs for the translation.
If your mod already uses New Horizons and supports translations, these values are added directly into the same translation files that NH uses.