diff --git a/changelog.txt b/changelog.txt index a709873..d477ed6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -8,7 +8,7 @@ Version: 3.1.2 - Increased enemy pheromone weight for pathing by 2.5x - Increased hive spawning outside resources chunks by 5x Bugfixes: - - Fixed sent aggressive squads count could be negative + - Fixed sent aggressive squads, builder count, squad count could be negative - Added missing sent and max siege groups on debug log - Fixed small amounts of death generator not being rounded to nil - Fixed enemy base pheromone missing decay based on radius diff --git a/libs/SquadAttack.lua b/libs/SquadAttack.lua index 52c60aa..b0125b7 100644 --- a/libs/SquadAttack.lua +++ b/libs/SquadAttack.lua @@ -437,6 +437,9 @@ function squadAttack.cleanSquads(universe, tick) removeSquadFromChunk(squad.map, squad) if squad.settlers then universe.builderCount = universe.builderCount - 1 + if universe.builderCount < 0 then + universe.builderCount = 0 + end else universe.squadCount = universe.squadCount - 1 if squad.type == BASE_AI_STATE_AGGRESSIVE then @@ -446,6 +449,9 @@ function squadAttack.cleanSquads(universe, tick) base.sentAggressiveGroups = 0 end end + if universe.squadCount < 0 then + universe.squadCount = 0 + end end squads[groupId] = nil elseif (group.state == 4) then