Error when using color-setting for runtime-per-user setting

This subforum contains all the issues which we already resolved.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1742
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Error when using color-setting for runtime-per-user setting

Post by Pi-C »

I've got a report that updating Autodrive from version 1.1.4 to 1.1.5 would reset all settings to their default values. Apparently, the same happened when updating GCKI from version 1.1.5 to 1.1.6 some days earlier.

There is one change that both mods have in common: They used to have a runtime-per-user setting for selecting a color where you could select predefined colors via a string-setting, which I've changed to a color-setting. This is how I define the color-setting in Autodrive:

Code: Select all

  {   -- Render color
    type = "color-setting",
    name = "autodrive-render-color",
    setting_type = "runtime-per-user",
    default_value = {r = 1.000, g = 0.630, b = 0.259, a = 1},
    order = "[autodrive]-[per-user]-b",
  },
How to reproduce:
  • Start Factorio with Autodrive 1.1.4.
  • Make sure that at least one setting (no matter whether a startup, runtime-global, or runtime-per-user setting) is set to a different value than the default.
  • Restart the game. Open Settings-->Mod settings to confirm that the setting(s) still have the non-default value.
  • Update to Autodrive 1.1.5.
  • Restart the game. When you open Settings-->Mod settings, you'll see that all settings have been reset to their default value.
  • Change any setting, of any type.
  • Edit file settings.lua of Autodrive 1.1.5 and change setting_type of setting "autodrive-render-color" to "runtime-global".
  • Restart the game. Open Settings-->Mod settings to find that the setting(s) still have the non-default value.
  • Edit file settings.lua of Autodrive 1.1.5 and change setting_type of setting "autodrive-render-color" to "startup".
  • Restart the game. Open Settings-->Mod settings to find, once again, that the setting(s) still have the non-default value.
When using Autodrive 1.1.5 when the color-setting was a runtime-per-user-setting, I've found this error message in my log file:

Code: Select all

   1.564 Error GlobalModSettings.cpp:161: Failed to read mod settings: Unsupported color format. Expected a list of 4 values { r, g, b, a } or a dictionary { r = ..., g = ..., b = ..., a = ... }.
This error makes no sense as the default_value of my setting clearly is a dictionary with the expected format, and as the setting doesn't raise an error if a different setting_type is used.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Rseding91
Factorio Staff
Factorio Staff
Posts: 14598
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Error when using color-setting for runtime-per-user setting

Post by Rseding91 »

The error is coming from trying to load the old mod setting value from the saved player settings. It should reset just the 1 mod setting after the migration finishes but it sounds like it's resetting the entire player settings which is the bug.
If you want to get ahold of me I'm almost always on Discord.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14598
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Error when using color-setting for runtime-per-user setting

Post by Rseding91 »

It's now fixed for the next 1.1.x release.
If you want to get ahold of me I'm almost always on Discord.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1742
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Error when using color-setting for runtime-per-user setting

Post by Pi-C »

Thank you! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Resolved Problems and Bugs”