Skip to content

Commit

Permalink
Kill ACUs when needed to prevent sharing
Browse files Browse the repository at this point in the history
Explode -> all acus die
Recall/Recall Delayed -> unsafe acus die
  • Loading branch information
lL1l1 committed Jun 12, 2024
1 parent 71ff6fc commit 173ace3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lua/SimUtils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,8 @@ function KillArmyOnDelayedRecall(self, shareOption, shareTime)
for i, com in sharedCommanders do
if com.LastTickDamaged + CommanderSafeTime > gameTick then
sharedCommanders[i] = nil
-- explode unsafe ACUs because KillArmy might not
com:Kill()
end
end

Expand Down
16 changes: 13 additions & 3 deletions lua/aibrain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -989,9 +989,19 @@ AIBrain = Class(AIBrainHQComponent, AIBrainStatisticsComponent, AIBrainJammerCom
local safeCommanders = {}

local commanders = self:GetListOfUnits(categories.COMMAND, false)
for _, com in commanders do
if com.LastTickDamaged + CommanderSafeTime <= GetGameTick() then
table.insert(safeCommanders, com)
if shareAcuOption == 'Recall' then
for _, com in commanders do
if com.LastTickDamaged + CommanderSafeTime <= GetGameTick() then
table.insert(safeCommanders, com)
else
-- explode unsafe ACUs because KillArmy might not
com:Kill()
end
end
else
-- explode all the ACUs so they don't get shared
for _, com in commanders do
com:Kill()
end
end

Expand Down

0 comments on commit 173ace3

Please sign in to comment.