events.on_territory_changed
Posted: Thu Jul 31, 2025 2:41 pm
2.0.61 introduced on_territory_created and on_territory_destroyed, as well as get/set/clear_territory_for_chunks(). Which is great! Thanks.
With the events we can track which chunks belong to which segmented_unit. However it's not possible to keep track of these chunks when other mods change the territories using one of the functions, without continuously checking the territories.
Request is to add a on_territory_changed event which is raised when clear_territory_for_chunks() or set_territory_for_chunks() is called.
Ideally the event is also raised when new segmented units are added to/removed from the territory (when writing to LuaSegmentedUnit.territory for example), so we know when territories become occupied/vacant.
---
The documentation also mentions in set_territory_for_chunks:
Which is currently not possible if patrol path and territory management are handled by different mods.
With the events we can track which chunks belong to which segmented_unit. However it's not possible to keep track of these chunks when other mods change the territories using one of the functions, without continuously checking the territories.
Request is to add a on_territory_changed event which is raised when clear_territory_for_chunks() or set_territory_for_chunks() is called.
Ideally the event is also raised when new segmented units are added to/removed from the territory (when writing to LuaSegmentedUnit.territory for example), so we know when territories become occupied/vacant.
---
The documentation also mentions in set_territory_for_chunks:
It is your responsibility to update the patrol path if needed.
Which is currently not possible if patrol path and territory management are handled by different mods.