Hi
I've got a mod that needs to recover from other mods being removed.
example situation:
1. you have mod A, B, C enabled at time of save.
2. you quit the world and disable mods B and C in Factorio.
3. you restart Factorio and reload the save.
4. Factorio removes the entities etc on loading of the save.
5. Mod A crashes because it relies on mod B and C.
How should I fix mod A so it can detect that mod B and C are no longer present?
What event should I have a handler to react to this situation?
thanks
How to detect a load that has had items removed due to missing mods?
Re: How to detect a load that has had items removed due to missing mods?
On configuration changed is the event that you will want to use. Its event data provides you with the mods that were removed so you can very easily react to the change.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: How to detect a load that has had items removed due to missing mods?
On_configuration_changed check entity.valid and/or check that the prototype exists.
https://lua-api.factorio.com/latest/Lua ... on_changed
https://lua-api.factorio.com/latest/Lua ... on_changed
Last edited by darkfrei on Fri May 10, 2019 7:05 am, edited 1 time in total.
Re: How to detect a load that has had items removed due to missing mods?
worked like a charm. thanks.