Note: I haven't checked if the 2.0 version is working
Unzip the mod, edit CustomColor/libraries/init.lua
Factorio 1.1 (mod version 3.1.2)
Change this part:
script.on_init(function()
global.car_catalog = {}
global.player_info = {}
for _, v in pairs(game.players) do
gui_create(v)
end
end)
To this:
script.on_init(function()
global.car_catalog = {}
global.player_info = {}
for _, v in pairs(game.players) do
global.player_info[_] = {color = v.color}
gui_create(v)
end
end)
Factorio 2.0 (mod version 3.2.1)
Change this part:
script.on_init(function()
storage.car_catalog = {}
storage.player_info = {}
for _, v in pairs(game.players) do
--gui_create(v)
end
end)
To this:
script.on_init(function()
storage.car_catalog = {}
storage.player_info = {}
for _, v in pairs(game.players) do
storage.player_info[_] = {color = v.color}
--gui_create(v)
end
end)
Then you need to remove the mod, load the save, overwrite the save, add the mod back, then it should be fixed.
There are other ways to fix that doesn't involve removing the mod first, but I'm not a modder so I'm not sure what the best practices are.
Explanation:
script.on_init runs when the mod is just added to the save (it won't run again afterwards, until it gets removed first). Here the mod just sets empty default values, and assumes updates will take care of new players.
However when we look at CustomColor/libraries/events.lua, the mod checks for on_player_created (runs on new player creation) and on_player_joined_game (runs on multiplayer join, not singleplayer load). That means if we load an already existing save the data will simply be missing, hence the error.
The way I fixed it is by changing script.on_init to immediately load all available player color data instead of delegating it to update.