Retrogening ores (migration script help)

Place to get help with not working mods / modding interface.
Post Reply
patmo98
Inserter
Inserter
Posts: 27
Joined: Sat Mar 21, 2015 10:59 pm
Contact:

Retrogening ores (migration script help)

Post by patmo98 »

I'm rather confused about how migration scripts work, and was hoping for some advice.

I am trying to update the mod RO (Resource Expansion) to 0.13.0. The mod is very simple. As you get farther from the starting point, it multiplies all patches of ore by a multiplier that increases as you get further away from the origin. So, if you're 4k away from the start, all patches of ore will be twice as dense.

So, all of that works now, but I'm also trying to make it retrogen ores. (Retroactively have this mod take effect, even if the chunks are already generated) I think the answer is to do this as a migration script.

What I want to happen:
*) If the world has been used with a previous version of RO, then do no migration
*) If the world has not been used with RO before, then call the Retrogen() function to boost all existing ore

This is sort of backwards from the way migration scripts work. So, what I would like to do is:
*) Create a flag in global that will say Retrogen is already done
*) Set the retrogen_done=true in the migration
*) Set retrogen_done=true in on_init
*) Call Retrogen() in on_load if retrogen_done==false, then set the flag to true


That's what I want to do, but on_load has a really big warning about how I must not touch the map data, or I will get desyncs:
https://wiki.factorio.com/index.php?tit ... le#on_load


Can someone please tell me what I should be doing?

Post Reply

Return to “Modding help”