Error when using color-setting for runtime-per-user setting
Posted: Tue May 30, 2023 9:28 pm
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:
How to reproduce:
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.
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",
},
- 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.
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 = ... }.