Skip to content

Commit

Permalink
Handle recalling ACUs
Browse files Browse the repository at this point in the history
don't stack recalls on them
also don't count them as an ACU that keeps your army alive
  • Loading branch information
lL1l1 committed Jun 12, 2024
1 parent 173ace3 commit df0d289
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lua/SimUtils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,14 @@ function KillArmyOnDelayedRecall(self, shareOption, shareTime)
if not table.empty(sharedCommanders) then
-- create a countdown to show when the ACU recalls (similar to the one used for timed self-destruct)
for _, com in sharedCommanders do
-- don't recall shared ACUs
if com.RecallingAfterDefeat then
sharedCommanders[i] = nil
continue
end
-- The shared ACUs don't count as keeping the army in the game since they will eventually be removed from the game.
-- see MatchState.lua CollectDefeatedBrains
com.RecallingAfterDefeat = true
StartCountdown(com.EntityId, math.floor((shareTime - GetGameTick())/10))
end

Expand Down
2 changes: 1 addition & 1 deletion lua/sim/MatchState.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ local function CollectDefeatedBrains(aliveBrains, condition, delay)
-- critical units found, make sure they all exist properly
local oneCriticalUnitAlive = false
for _, unit in criticalUnits do
if (not IsDestroyed(unit)) and (unit:GetFractionComplete() == 1) then
if (not IsDestroyed(unit)) and (unit:GetFractionComplete() == 1) and not unit.RecallingAfterDefeat then
oneCriticalUnitAlive = true
break
end
Expand Down

0 comments on commit df0d289

Please sign in to comment.