Page 1 of 1

[0.12.10][posila]Remove Rail mod -> unloadable save

Posted: Tue Oct 06, 2015 3:13 am
by Razaekel
Issue:

Removing a rail mod (Ex: Concreted Rails) from the modlist and then loading a save with modded rails placed down results in aborting the load and the following message: 'Entity cannot be destroyed'.

Replication:

1. Start a game with a rail mod enabled (Concreted Rails, I assume Tug would do this too).
2. place down a rail from the rail mod.
3. Save and exit.
4. Disable the rail mod.
5. Restart Factorio.
6. Load the save.
7. Cry (no not really).

Attachments:
Rail mod (Concreted Rails)
Save with the rail mod installed

Re: [0.12.10][posila]Remove Rail mod -> unloadable save

Posted: Thu Oct 08, 2015 1:29 pm
by posila
This was hard one. Thanks for the report. Fixed for 0.12.11 (only for saves 0.12.11+)
I had to split "rail" entity type into "straight-rail" and "curved-rail" so you will need to adjust your mod.

Re: [0.12.10][posila]Remove Rail mod -> unloadable save

Posted: Fri Oct 09, 2015 8:56 pm
by Choumiko
posila wrote:I had to split "rail" entity type into "straight-rail" and "curved-rail" so you will need to adjust your mod.
This means any call to LuaSurface:find_entities_filtered with type = "rail" will have to be rewritten to to type = "straight-rail" and a second call with type = "curved-rail", right?

Re: [0.12.10][posila]Remove Rail mod -> unloadable save

Posted: Fri Oct 09, 2015 9:14 pm
by posila
Choumiko wrote:This means any call to LuaSurface:find_entities_filtered with type = "rail" will have to be rewritten to to type = "straight-rail" and a second call with type = "curved-rail", right?
Unfortunately, that is right. If it turns out to be performance problem for FARL, let us know.

Re: [0.12.10][posila]Remove Rail mod -> unloadable save

Posted: Sat Oct 10, 2015 11:36 am
by Choumiko
posila wrote:Unfortunately, that is right. If it turns out to be performance problem for FARL, let us know.
I just checked the code, most of the time i'm using name instead of type anyways. One search for type can now be replaced by LuaTrain::front_rail, the others might actually be better replaced by an unfiltered search, since i'm calling that for 5+ different types. And i just had an idea for a API request :D