Mod settings not working?

Place to get help with not working mods / modding interface.
tomkcook
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Feb 19, 2018 1:30 pm
Contact:

Mod settings not working?

Post 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
User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 471
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: Mod settings not working?

Post 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.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground
Post Reply

Return to “Modding help”