Migration for mod deactivation

Place to get help with not working mods / modding interface.
AngledLuffa
Fast Inserter
Fast Inserter
Posts: 187
Joined: Fri Jan 05, 2018 5:18 pm
Contact:

Migration for mod deactivation

Post by AngledLuffa »

Is there a way to make a migration run when a mod is disabled or deactivated?

I'm maintaining a mod which wipes out all existing biters and prevents new ones from appearing. When the mod is disabled, new territory will eventually contain biters, and they'll start spreading from the newly discovered tiles back into the previous map. However, one user reports that they are on an island, so now their biters are gone forever even if the mod is disabled.

If I could run a migration when the mod is disabled, I could either remember the latest 100 spawners to be destroyed and recreate them, or I could seed a few new spawners just outside the pollution cloud.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Migration for mod deactivation

Post by Choumiko »

There is no way.
You could add a command to do the uninstall/deactivate your mod before they remove it
Pi-C
Smart Inserter
Smart Inserter
Posts: 1742
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Migration for mod deactivation

Post by Pi-C »

Choumiko wrote: Sun Oct 13, 2019 3:51 am There is no way.
You could add a command to do the uninstall/deactivate your mod before they remove it
Would a pre-removal release that migrates to default behavior make sense? Or an optional dependency on a mod with just a migration script and a conflict against the main mod?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Migration for mod deactivation

Post by Choumiko »

Never given it much thought.

A pre removal release would have probably to be a different mod (unless you give it a lower version number than the current release, which would require a manual download) else you get people auto updating and then complaining that it doesn't work anymore (sounds like fun if he restores the last 100 biter nests on a map without any military tech :D)
Optional dependency might work, depending on what data the uninstall mod needs (stuff in global from the mod) you might need a remote interface which doesn't allow setting a conflict to disable the mod.

In any case the player will have to read how to uninstall and i'd probably prefer a command. Let's me decide for which save i want it disabled without having to change mods when switching games (assuming the uninstall command unregisters all events so that the mod does nothing anymore)

https://mods.factorio.com/mod/BitersBegoneUpdated is the mod in question i think.
So for the case of being on an island i'd probably try if https://lua-api.factorio.com/latest/Lua ... ate_entity works for biter spawners and then use that for all chunks without pollution?
AngledLuffa
Fast Inserter
Fast Inserter
Posts: 187
Joined: Fri Jan 05, 2018 5:18 pm
Contact:

Re: Migration for mod deactivation

Post by AngledLuffa »

(sounds like fun if he restores the last 100 biter nests on a map without any military tech :D)
LOL! Guess my "sales" would go down quite a bit if I started doing that.

Yes, BitersBegoneUpdated is the mod in question. regenerate_entity looks great, assuming it works for bringing back spawners if I give a list of spawners and/or chunks. A list of unpolluted chunks sounds perfect, so I might give that a try first and not even bother keeping track of the most recently deleted spawners. It could be an option in the mod's config, I suppose. If that option is selected, then the mod no longer deletes entities, and when the config value is changed, it regenerates everything it can.

Seems like I have a plan and a couple things to try. Thanks for the help!
Post Reply

Return to “Modding help”