[0.11.7] Crash while loading a save with mod

This subforum contains all the issues which we already resolved.
Kikkers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sun Jun 22, 2014 8:45 pm
Contact:

[0.11.7] Crash while loading a save with mod

Post by Kikkers »

Minor bug.

I tried loading a 0.11.6 save with [base mod]+[smart circuit systems 0.3.6] into 0.11.7 with only [base mod].
This crashed the game instead of showing an error. I would expect just an error.

Loading the same save with [base mod]+[smart circuit systems 0.3.6] enabled works just fine.
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.11.7] Crash while loading a save with mod

Post by kovarex »

Hello, I knew about the problem of loading mods that contain electric poles compatibility problems, and I made a mental note to fix it year ago :)
You finally made me to actually fix it.

So now the engine correctly reconnects electric machines to electric poles when their reach changes because of mods, and also correctly reacts to removal of electric-pole mod content due to mod removal.

So it should be fixed for 0.11.8
Kikkers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sun Jun 22, 2014 8:45 pm
Contact:

Re: [0.11.7] Crash while loading a save with mod

Post by Kikkers »

Took me a while to understand how this fixes the mod. I'm guessing that whenever a mod from a save isn't used, you simply remove all mod-generated glob values and entities that contain mod-native prototypes. I previously thought that the save would simply not load.
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.11.7] Crash while loading a save with mod

Post by kovarex »

It is actually much much more complicated that this :)

When you have a mod with electric pole, the game needs to load the electric pole (without knowing it's properties, because the pole is gone). Then it needs to setup the connection with the pole and all the surrounding entities. Once the connection is setup and all the other data structures prepared (electric network data structures, electric poles etc.). The game then needs to remove the remove the pole with all the necessary cleanup (splitting energy networks, disconnecting all the machines etc.).

The change I made is, that now the savegame contains the information about the supply reach of the pole, so when the game loads an electric pole, that is no longer available (because of a mod removal), or when the supply reach data changed (the mod changed the reach of the pole in new version), it needs to first disconnect all entities in the old range, update it to the new one and reconnect entities again, this way everything is in proper game state.
Kikkers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sun Jun 22, 2014 8:45 pm
Contact:

Re: [0.11.7] Crash while loading a save with mod

Post by Kikkers »

Ha, quite a bit more complicated indeed. It does explain some things, such as why every mod prototype needs to inherit behavior from a specific type, it ensures a fallback prototype.

Would be a bit strange though in this specific mod, as it creates numerous extra entities (poles, smart chests, decorations) that overlap in the same tile. But well, as long as it works :P .
Post Reply

Return to “Resolved Problems and Bugs”