Deinit?
- SupplyDepoo
- Filter Inserter
- Posts: 305
- Joined: Sat Oct 29, 2016 8:42 pm
- Contact:
Deinit?
Is there a way to run code when a mod is removed in order to clean up stuff that the player would not expect to stick around, such as surfaces added by the mod?
Re: Deinit?
No. When the game opens a save file with a mod (lets call it modA), that the game doesnt run, the game has no access to modA. It should, however, be possible to have the init file of a different mod (modB), which is active, detect if modA is not active and if so, delete certain stuff, which modA created.
Re: Deinit?
If you've made some excessive changes that would persist even after your mod has been uninstalled, you could also define a command players can use to reset things. Naturally, the command should be called before the mod is uninstalled! (Example: In GCKI, players can "lock" their vehicles, which sets their 'active', 'operable', and 'minable' flags to false. After the mod has been removed, there'd be no way to drive, mine, or open the inventory of such vehicles, so I've added a command '/GCKI-reset' that makes all locked vehicles usable again.)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
- SupplyDepoo
- Filter Inserter
- Posts: 305
- Joined: Sat Oct 29, 2016 8:42 pm
- Contact:
Re: Deinit?
Great, thanks!