From ebcf9b9ff5062e13ddfcc27c81984f5bcab3d5d6 Mon Sep 17 00:00:00 2001 From: Freagarach Date: Thu, 7 Jan 2021 15:30:25 +0000 Subject: [PATCH] Fix promoting entities not reacting to nearby enemies. When an entity promotes it autogarrisons in the turret position but because `GARRISONE.enter` returns early a turret never reaches the `IDLE`-state and thus won't automatically react on nearby enemies. This is explicitly a temporary fix. Differential revision: D3293 Reviewed by: @wraitii This was SVN commit r24521. --- .../data/mods/public/simulation/components/UnitAI.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/binaries/data/mods/public/simulation/components/UnitAI.js b/binaries/data/mods/public/simulation/components/UnitAI.js index 1978380de5..b0347e431b 100644 --- a/binaries/data/mods/public/simulation/components/UnitAI.js +++ b/binaries/data/mods/public/simulation/components/UnitAI.js @@ -3119,8 +3119,17 @@ UnitAI.prototype.UnitFsmSpec = { return true; } - if (this.IsGarrisoned()) + // Called when autogarrisoning. + if (this.isGarrisoned) + { + this.SetImmobile(true); + if (this.IsTurret()) + { + this.SetNextState("IDLE"); + return true; + } return false; + } if (this.CanGarrison(target)) if (this.CheckGarrisonRange(target))