I just noticed that the game won't start if both Simple Silicon and Xander Mod are active. I get this error on loading Factorio:
1.960 Error ModManager.cpp:1469: Failed to load mod "SimpleSilicon": __SimpleSilicon__/data-updates.lua:2: __SimpleSilicon__/prototypes/recipe_updates.lua:4: attempt to index field 'normal' (a nil value)
stack traceback:
__SimpleSilicon__/prototypes/recipe_updates.lua:5: in main chunk
[C]: in function 'require'
__SimpleSilicon__/data-updates.lua:2: in main chunk
The error occurs in this loop:
for k,r in pairs(data.raw["recipe"]["advanced-circuit"]["normal"]["ingredients"]) do -- ERROR OCCURS HERE
if r.name == "SiSi-silicon-wafer" then
recipe_already_changed = true
end
end
There's nothing wrong with your code as such -- but the other mod seems to overwrite (instead of just change) other recipes and removes difficulties, so when this code is executed, data.raw["recipe"]["advanced-circuit"]["normal"] doesn't exist anymore. I've already reported this bug to the author of Xander Mod, as this also breaks one of my mods, but I thought you should know about this as well. :-)
The easiest solution would be to add a conflict against Xander Mod. You could also add an optional (or even a hidden optional) dependency on it (so it's guaranteed to load before your mod) and restore difficulties of all recipes your mod needs before changing them in data-updates.lua or data-final-fixes.lua. The best (but also the most complicated) solution would be to always make sure all recipes exist and are the way you expect them (i.e. make sure they have difficulties, and make sure the ingredients have the correct format -- one of my mods crashed because some other mod added a new ingredient as {type = …, name = …, amount = …} while mine expected the short form) before manipulating them. This way, no other mod (whether you've a dependency on it or not) could break yours.