From 173ace357283e39362cf8856f44e63b9b675210e Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Wed, 12 Jun 2024 06:40:14 -0700 Subject: [PATCH] Kill ACUs when needed to prevent sharing Explode -> all acus die Recall/Recall Delayed -> unsafe acus die --- lua/SimUtils.lua | 2 ++ lua/aibrain.lua | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lua/SimUtils.lua b/lua/SimUtils.lua index e7d979a90b..854d2e10c3 100644 --- a/lua/SimUtils.lua +++ b/lua/SimUtils.lua @@ -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 diff --git a/lua/aibrain.lua b/lua/aibrain.lua index 019064c598..3dde4ef9d5 100644 --- a/lua/aibrain.lua +++ b/lua/aibrain.lua @@ -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