I changed all the underground mining drill entities in my mod, to be assembly machine instead of container, so I can make them use energy, but what I got is this:
entity underground-mining-drill saved as type container, but is now type assembly machine.
Is there any easy way to fix this without removing all the underground mining drills?
Changing entities types
-
- Filter Inserter
- Posts: 559
- Joined: Mon Mar 04, 2013 9:23 am
- Contact:
Re: Changing entities types
I'm not sure about this but I belive you would need to write some special script which would execute on savegame load one similar to those scripts used for loading savegames made with previous versions of Factorio.
So I suggest that you check those scripts to get the idea of what you need to do.
So I suggest that you check those scripts to get the idea of what you need to do.
Re: Changing entities types
I could leave the old mining drill, and the new mining drill, and replace them on the startup, but I prefer to make it less messy
Re: Changing entities types
The entity can't just change the type, it would break the serialisation (every type loads different values).
The only solution I can think of is to make the new entity completely new and leave the old one there and then go through all old entities destroy them and place the new one instead.
This could be done in the migration script, so it is done only once per save and only for old saves (not new games).
The only solution I can think of is to make the new entity completely new and leave the old one there and then go through all old entities destroy them and place the new one instead.
This could be done in the migration script, so it is done only once per save and only for old saves (not new games).