I've got a save file with a ton of mods for debugging one of my mods, including yours and Project Cybersyn - Logistics Train Dispatcher. On starting a new game, I get this crash:
224.514 Error AppManagerStates.cpp:2520: The mod Project Cybersyn (1.2.13) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event cybersyn::on_init()
The mod Player Trails (0.0.1) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event player-trails::on_runtime_mod_setting_changed (ID 61)
Expected LuaPlayer, index, or name.
stack traceback:
[C]: in function 'get_player_settings'
__player-trails__/control.lua:49: in function 'initialize_settings'
__player-trails__/control.lua:64: in function <__player-trails__/control.lua:63>
stack traceback:
[C]: in function '__newindex'
__cybersyn__/scripts/main.lua:904: in function <__cybersyn__/scripts/main.lua:901>
Cybersyn will change a global setting in on_init:
script.on_init(function()
local setting = settings.global["cybersyn-invert-sign"]
setting.value = false
settings.global["cybersyn-invert-sign"] = setting
mod_settings.invert_sign = false
init_global()
setup_se_compat()
end)
Your mod expects that on_runtime_mod_setting_changed will have event.player_index:
local function initialize_settings(index)
if not global.settings then
global.settings = {}
end
local player_settings = settings.get_player_settings(index)
…
end
script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
initialize_settings(event.player_index)
end)
However, according to the description player_index is an optional value:
If the setting_type is "global" and it was changed through the mod settings GUI, this is the index of the player that changed the global setting. If the setting_type is "runtime-per-user" and it changed a current setting of the player, this is the index of the player whose setting was changed. In all other cases, this is nil.