Mod configuration (config.json)

Mods can provide a config.json file to expose player-configurable options in the game's settings UI. A JSON schema file (config.schema.json) is included for IDE IntelliSense support.

Supported parameter types

Type default value Extra fields/constraints
Boolean true / false -
String "text" max_length, regex
Integer 42 min, max, is_integer (must be true)
Float 5.3 min, max

Parameter names must be in snake_case format.

Example config

{
  "enable_feature": {
    "default": true,
    "description": "Enable the custom feature."
  },
  "production_multiplier": {
    "default": 42,
    "min": 1,
    "max": 100,
    "is_integer": true,
    "description": "Production multiplier for custom recipes."
  }
}

Accessing config values in code

int multiplier = JsonConfig.GetInt("production_multiplier");
bool enabled = JsonConfig.GetBool("enable_feature");

// React to changes made by the player in settings UI
JsonConfig.OnValueChanged += paramName => { /* handle change */ };

Config values are persisted in save files. Use MigrateJsonConfig() to handle schema changes between mod versions.