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.
Migration for mod deactivation
-
- Fast Inserter
- Posts: 187
- Joined: Fri Jan 05, 2018 5:18 pm
- Contact:
Re: Migration for mod deactivation
There is no way.
You could add a command to do the uninstall/deactivate your mod before they remove it
You could add a command to do the uninstall/deactivate your mod before they remove it
Re: Migration for mod deactivation
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!
Re: Migration for mod deactivation
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 )
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?
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 )
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?
-
- Fast Inserter
- Posts: 187
- Joined: Fri Jan 05, 2018 5:18 pm
- Contact:
Re: Migration for mod deactivation
LOL! Guess my "sales" would go down quite a bit if I started doing that.(sounds like fun if he restores the last 100 biter nests on a map without any military tech )
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!