From 498f5eb0833c6315ca07e2df456c607cc05cbf06 Mon Sep 17 00:00:00 2001 From: Angen Date: Sat, 23 Jan 2021 15:07:15 +0000 Subject: [PATCH] Fix cheering issue entering from idle state Introduced in e543b01077. Units entering cheering from idle state, may not check their surrounding for pottential targets yet, so they will react incorrectly when attacked. Pointed out by @Freagarach in https://code.wildfiregames.com/D1977?id=10404#inline-52415 and turned out to be issue. Differential revision: D3455 Fixes: #5966 Reviewed by: @wraitii This was SVN commit r24774. --- binaries/data/mods/public/simulation/components/UnitAI.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binaries/data/mods/public/simulation/components/UnitAI.js b/binaries/data/mods/public/simulation/components/UnitAI.js index 084cf876f6..26ae0d75d4 100644 --- a/binaries/data/mods/public/simulation/components/UnitAI.js +++ b/binaries/data/mods/public/simulation/components/UnitAI.js @@ -1523,8 +1523,8 @@ UnitAI.prototype.UnitFsmSpec = { "IDLE": { "Order.Cheer": function() { - // Do not cheer if there is no cheering time. - if (!this.cheeringTime) + // Do not cheer if there is no cheering time and we are not idle yet. + if (!this.cheeringTime || !this.isIdle) return { "discardOrder": true }; this.SetNextState("CHEERING");