On occasion some users when joining an MP game running this mod will fail with the error:
Mods mismatch detected!
ScienceCostTweakerM: Mod contents are different even though versions are the same
Both freshly downloaded from the mod manager in-game. Testing on multiple OS's across multiple networks.
After diagnosing with #factorio on IRC they've found that the mod does conditional require() calls, which is absolutely a (their words) no-no on the factorio engine for consistency reasons and can cause this exact error. One such example they cited was specifically at https://github.com/mexmer/ScienceCostTweakerM/blob/master/data.lua#L20-L22 where a require call is wrapped in a conditional. Instead they state that all require calls should be top level so they are always require'd regardless, and instead conditional tests should be put into the file itself or the calls to things inside the files. Because of this the game cannot synch the server settings to the client in all cases (deterministically pseudo-random based on various things about how the game loaded and so forth) and thus will fail to join the game.
Do not conditionally 'require(...)' things: This breaks the CRC checks and people will get errors trying to use your mod in multiplayer. 'require(...)' everything and then conditionally add the values to data.raw using the settings.
As reported at: https://mods.factorio.com/mod/ScienceCostTweakerM/discussion/5ca8e3b66ffc54000bf54abf
On occasion some users when joining an MP game running this mod will fail with the error:
Both freshly downloaded from the mod manager in-game. Testing on multiple OS's across multiple networks.
After diagnosing with #factorio on IRC they've found that the mod does conditional
require()
calls, which is absolutely a (their words)no-no
on the factorio engine for consistency reasons and can cause this exact error. One such example they cited was specifically at https://github.com/mexmer/ScienceCostTweakerM/blob/master/data.lua#L20-L22 where a require call is wrapped in a conditional. Instead they state that all require calls should be top level so they are alwaysrequire
'd regardless, and instead conditional tests should be put into the file itself or the calls to things inside the files. Because of this the game cannot synch the server settings to the client in all cases (deterministically pseudo-random based on various things about how the game loaded and so forth) and thus will fail to join the game.They made a point to mention to pass this on to you as well: https://wiki.factorio.com/Tutorial:Mod_settings#Tips
Specifically the point of: