diff --git a/changelog.txt b/changelog.txt index a03b330..3f6769b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,9 @@ Version: 3.3.0 Improvements: - Re-added kamikaze squad state to prevent unit group dancing and then disbanding + - Squad compression can be triggered multiple times on a single group + Tweaks: + - On group destruction all members are destroyed to prevent orphaned biters Bugfixes: - Fixed occasionally compression number wouldn't appear on unit group - Fixed squad compression could take place when attacking diff --git a/libs/Squad.lua b/libs/Squad.lua index 2c279d7..bca9bc9 100644 --- a/libs/Squad.lua +++ b/libs/Squad.lua @@ -277,7 +277,7 @@ local function addMovementPenalty(squad, chunk) squad.kamikaze = true squad.penalties = {} else - for entity in pairs(squad.group.members) do + for _, entity in pairs(squad.group.members) do if entity.valid then entity.destroy() end @@ -726,6 +726,11 @@ function Squad.cleanSquads(tick) Squad.squadDispatch(squad, tick) elseif (squad.commandTick and (squad.commandTick < tick)) then if squad.wanders > 5 then + for _, entity in pairs(squad.group.members) do + if entity.valid then + entity.destroy() + end + end squad.group.destroy() else squad.wanders = squad.wanders + 1