Author Topic: Warning to modders: avoid redefining "region_settings"  (Read 319 times)

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3839
    • View Profile
Warning to modders: avoid redefining "region_settings"
« on: October 19, 2017, 11:35:31 PM »
Many mods use
Code: [Select]
"type": "region_settings" structure.
This json is pretty huge and redefines a lot of things. It sometimes just needs to be changed. Because of the old code it uses, lack of examples (other than core), sheer size, and some weird practices, maintaining backwards compatibility of this structure isn't always as straightforward as it looks.
This means high chances of things breaking if you redefine it.

Instead, if possible, use
Code: [Select]
"type": "region_overlay", like in DinoMod. Redefine only things that you need redefined.
While this won't always warn you that things aren't working, they will still get default values instead of kicking you back to main menu.

Changing "region_settings" in the core necessary if we want to have reasonable cities, biomes, weather etc. so expect it to be disturbed once in a while. Not without warning, but the warning will usually be a PR on github, not a message on forums (like this one).

Offline Zhilkin

  • NPC
  • **
  • Posts: 218
    • View Profile
Re: Warning to modders: avoid redefining "region_settings"
« Reply #1 on: October 20, 2017, 07:37:42 AM »
Example from DinoMod:

Code: [Select]
[
   {
      "type": "region_overlay",
      "id": "dinomod_overlay",              "//": "unique identifier for this overlay",
      "regions": [ "all" ],                 "//": "A list of regions to which this overlay should be applied",
      "city": {
          "parks": {                        "//": "weighted list for park overmap terrains",
              "fieldoffice": 1
          }
      }
   }
]