Page 1 of 1

Mod settings not working?

Posted: Mon Feb 19, 2018 1:57 pm
by tomkcook
I'm brand new to modding and trying to figure out why someone else's mod isn't working, so sorry if this is a daft question.

There's a setting which is declared in settings.lua like this:

Code: Select all

data:extend{
  {
    type = "string-setting",
    name = "railloader-allowed-items",
    default_value = "ore",
    allowed_values = { "ore", "ore, plates", "any" },
    setting_type = "runtime-global",
  },
  ...
}
I've changed the setting in the game's UI and now my mod-settings.json contains this:

Code: Select all

{
  "startup": {},
  "runtime-global": {
    ...
    "railloader-allowed-items": {
      "value": "any"
    },
    ...
  },
  "runtime-per-user": {}
}
In control.lua I do this:

Code: Select all

local allowed_items_setting = settings.global["railloader-allowed-items"].value
log("{allowed_items_setting = "..allowed_items_setting.."}")
And then factorio-current.log has this:

Code: Select all

  78.402 Script @__railloader__/control.lua:16: {allowed_items_setting = ore}
What's going on? Why is the value in mod-settings.json changed but the value seen by the mod not changed?

I'm running Factorio 0.16.24 on Ubuntu 17.10, if that helps.

Thanks for any help,
Tom

Re: Mod settings not working?

Posted: Mon Feb 19, 2018 6:12 pm
by Therax
"Runtime-global" settings are stored per-map in the save file, so your mod-settings.json only takes effect when starting a new game.