b Randomly failing when user joins MP game
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.
They made a point to mention to pass this on to you as well:
Specifically the point of:
- 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.
that conditional is until i fix compatibility with other mods, defaults to false, and players should not use that setting. so this one should not cause issues. but i can see other places, where it can cause problems, if players have different settings than server.
thanks for info.
I did change conditionals, so let me know, if you will experience error again