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

Place to get help with not working mods / modding interface.
Post Reply
Kingdud
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Sat Dec 16, 2017 3:23 am
Contact:

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

Post 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?

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

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

Post by posila »

Changing type of an entity will do migration implicitly (no need for you to explicitly define migration definition nor migration script).

Kingdud
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Sat Dec 16, 2017 3:23 am
Contact:

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

Post 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?

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

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

Post 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.

Kingdud
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Sat Dec 16, 2017 3:23 am
Contact:

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

Post by Kingdud »

Ok, thanks.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post 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.
If you want to get ahold of me I'm almost always on Discord.

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

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

Post 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.

Post Reply

Return to “Modding help”