"Cannot Join. The following mod event handlers are not identical between you and the server. This indicates that the following mods are not multiplayer (save/load) safe."
What causes this error in a mod, and how do I fix it?
viewtopic.php?f=144&t=26473
Its kinda irritating, and I didn't change anything.
Mod multiplayer
- Ranakastrasz
- Smart Inserter
- Posts: 2174
- Joined: Thu Jun 12, 2014 3:05 am
- Contact:
Mod multiplayer
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
Re: Mod multiplayer
You are registering tick in on_init
Conditionally removing tick in the tick handler
not checking on_load to see if the tick handler is registered or not.
Conditionally removing tick in the tick handler
not checking on_load to see if the tick handler is registered or not.
Re: Mod multiplayer
You are also changing it around to things like 0 and nil
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Mod multiplayer
Long story short, when it comes to variables, only ever do 1 of 2 things.
Everything in global
A constant (varible = value and NEVER change it)
local within a function for temporary variables (calculated the same by every player)
if it doesn't fit one of those things, you're doing it wrong. A recent update changed to error when it detects these issues, rather than just allowing a possible desync.
Everything in global
A constant (varible = value and NEVER change it)
local within a function for temporary variables (calculated the same by every player)
if it doesn't fit one of those things, you're doing it wrong. A recent update changed to error when it detects these issues, rather than just allowing a possible desync.
- Ranakastrasz
- Smart Inserter
- Posts: 2174
- Joined: Thu Jun 12, 2014 3:05 am
- Contact:
Re: Mod multiplayer
Hmm.
I suppose need to find a more recent mod to copy, since I've been doing that for a long time, given it is how other mods did that.
I suppose need to find a more recent mod to copy, since I've been doing that for a long time, given it is how other mods did that.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
- Ranakastrasz
- Smart Inserter
- Posts: 2174
- Joined: Thu Jun 12, 2014 3:05 am
- Contact:
Re: Mod multiplayer
I thought you were supposed to do that?Nexela wrote:You are registering tick in on_init
Forgot to remove that. IT never runs anyway, since "shouldKeepTicking" cannot change to anything but true. Its an artifact from the mod.. Probably from V11 or something that I copied it from.Conditionally removing tick in the tick handler
Had events to turn the ticker on and off.
I thought you couldn't double-register, and it just overrode it, at least in a single mod. After all, you deregister by setting it to nil, or null, or whichever it is in lua.not checking on_load to see if the tick handler is registered or not.
The way I understand it now, is that you need to register on game initilization, and on Mod configuration change, which are the two possiblities that can occur. Both run only when the host starts the game.
Could someone point me at how to do this correctly? Its been annoying pretty much since I started modding.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
Re: Mod multiplayer
Registering in on_init is fine but that means you are conditionally registering. If you don't want to register conditionally then move your tick registration out of on_init
if you don't need a conditional tick handler then just
http://lua-api.factorio.com/latest/Data-Lifecycle.html
Code: Select all
on_init
global.ticking = true
register on_tick()
end
on_load
if global.ticking = true then
register on_tick()
end
on_tick
if don't need to tick anymore then
global.ticking = false
de register on_tick()
end
Code: Select all
on_init
--set up all vars
end
script.on_event(defines.events.on_tick, tick)
- Ranakastrasz
- Smart Inserter
- Posts: 2174
- Joined: Thu Jun 12, 2014 3:05 am
- Contact:
Re: Mod multiplayer
Ok, that makes sense.
I think I understand.
I think I understand.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16