What did you do?
Working with the new LuaTerritory.destroy() function in an upcoming feature of my mod.
What happened?
The destroyed territory seems reappeared after a new chunk generation??
See this in action:
https://www.youtube.com/watch?v=fU1R8WVcjZI
See screenshot for the code I used to clean up territory. I ran it in 5s interval, hence you see that territory flashing in the first part of the video.
What did you expect to happen instead? It might be obvious to you, but do it anyway!
destroy territory should not reappear.
Does it happen always, once, or sometimes?
Always
[2.0.64] Territory reappear after calling LuaTerritory destroy()
[2.0.64] Territory reappear after calling LuaTerritory destroy()
- Attachments
-
- Territory-Bug.png (333.42 KiB) Viewed 234 times
Re: [2.0.64] Territory reappear after calling LuaTerritory destroy()
Did you explore EVERY chunk of the Territory, or just “most of them”? I don’t see anything in your code to Destroy the SegmentedUnit itself. It sure seems like the map generator is (correctly) bringing the Territory back as it tries to fill in the missing chunks and/or determine pathing for the now-Homeless Demolisher.
Re: [2.0.64] Territory reappear after calling LuaTerritory destroy()
No I did not explore the whole area. That call destroys the segment unit as well.
From the function description, "Immediately destroys the territory, along with any segmented units guarding it. All associated chunks are cleared from the territory system, allowing the map generator to potentially generate new territories for these chunks in the future."
I guess you are right. map gen immediately bring back the territory. It feels like there are improvement on how map gena and destroy() work together. This issue defeats the purpose of calling destroy() when the map isn't fully explored.
I can probably workaround by charting all chunks in the territory. I don't really want to do that if I can avoid it.
From the function description, "Immediately destroys the territory, along with any segmented units guarding it. All associated chunks are cleared from the territory system, allowing the map generator to potentially generate new territories for these chunks in the future."
I guess you are right. map gen immediately bring back the territory. It feels like there are improvement on how map gena and destroy() work together. This issue defeats the purpose of calling destroy() when the map isn't fully explored.
I can probably workaround by charting all chunks in the territory. I don't really want to do that if I can avoid it.
Re: [2.0.64] Territory reappear after calling LuaTerritory destroy()
I am going to call this working as intended because when new chunks are generated they do not belong to any territory and generate a new territory which also spawns a new demolisher and area shows as dangerous. If you want the area to not show as dangerous just remove all segmented units inside of it but leave the territory intact so the game will remember this area was conquered. Deleting a territory deletes this piece of data and so map generator recreates fresh territories.