Page 1 of 1

[0.17->0.18] Prototype change migration not possible?

Posted: Sat Mar 28, 2020 3:07 pm
by Kingdud
I'm reading conflicting reports. https://lua-api.factorio.com/latest/Migrations.html indicates the entire purpose of the migrations API is to fix things when you do have to change the prototype of an item (in my case, a generator to a burner-generator). But every example I can find is only for prototypes that got renamed, but did NOT have their base type changed. Further more, https://wiki.factorio.com/Tutorial:Modd ... Migrations seems to indicate that changing the type of a prototype (so, type=generator -> type=burner-generator) is not possible.

Which is it? And how would I write a migration for a generator becoming a burner-generator?

Re: [0.17->0.18] Prototype change migration not possible?

Posted: Sat Mar 28, 2020 3:15 pm
by posila
Changing type of an entity will do migration implicitly (no need for you to explicitly define migration definition nor migration script).

Re: [0.17->0.18] Prototype change migration not possible?

Posted: Sat Mar 28, 2020 3:20 pm
by Kingdud
Ok. Then how do I go about fixing the real problem I have: my reactors are fueled with u238 (I made it a fuel category back in .17) and when I migrate to .18, the reactors all have their fuel removed. How do I get the fuel to move over into the new reactors?

Re: [0.17->0.18] Prototype change migration not possible?

Posted: Sat Mar 28, 2020 3:30 pm
by posila
Well, to do that, you need to keep the old prototype, create new one under different name, and add migration script (Lua migration) that finds all entities of the old type, gets whatever info it needs to migrate them and then replace them with entity of the new type.

Re: [0.17->0.18] Prototype change migration not possible?

Posted: Sat Mar 28, 2020 3:31 pm
by Kingdud
Ok, thanks.

Re: [0.17->0.18] Prototype change migration not possible?

Posted: Mon Mar 30, 2020 3:43 am
by Rseding91
You should be able to just add a json migration for the old to new entity name and it will fast-replace transfer the contents from the old to the new.

Re: [0.17->0.18] Prototype change migration not possible?

Posted: Mon Mar 30, 2020 6:34 am
by posila
Rseding91 wrote:
Mon Mar 30, 2020 3:43 am
You should be able to just add a json migration for the old to new entity name and it will fast-replace transfer the contents from the old to the new.
Implicit cross-type migration does fast-replace transfer too, afaik. But generator and burner-generator are not fast replacable.