Page 1 of 1
Migration for mod deactivation
Posted: Sat Oct 12, 2019 10:08 pm
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.
Re: Migration for mod deactivation
Posted: Sun Oct 13, 2019 3:51 am
by Choumiko
There is no way.
You could add a command to do the uninstall/deactivate your mod before they remove it
Re: Migration for mod deactivation
Posted: Sun Oct 13, 2019 7:45 am
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?
Re: Migration for mod deactivation
Posted: Sun Oct 13, 2019 8:44 am
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
)
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?
Re: Migration for mod deactivation
Posted: Mon Oct 14, 2019 1:46 am
by AngledLuffa
(sounds like fun if he restores the last 100 biter nests on a map without any military tech
)
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!