From 32ae70bf7b2a7fa919fccf80632cd6831d679326 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Thu, 21 Nov 2024 12:47:56 -0800 Subject: [PATCH] Fix `GetArmyBrain` being called on observers in sim side of recall (#6538) --- changelog/snippets/fix.6396.md | 1 + lua/sim/Recall.lua | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog/snippets/fix.6396.md diff --git a/changelog/snippets/fix.6396.md b/changelog/snippets/fix.6396.md new file mode 100644 index 0000000000..e09da003a4 --- /dev/null +++ b/changelog/snippets/fix.6396.md @@ -0,0 +1 @@ +- (#6396, #6538) Fix recall failing on 1 "no" vote less than needed, dead players having their previous recall votes still in effect, and multiple bugs with the voting UI (mainly previous votes showing up again for new recalls). diff --git a/lua/sim/Recall.lua b/lua/sim/Recall.lua index 6775a7e577..4eb1359880 100644 --- a/lua/sim/Recall.lua +++ b/lua/sim/Recall.lua @@ -111,8 +111,13 @@ end ---@return CannotRecallReason ---@return number? cooldown no timeout/cooldown if absent function ArmyRecallRequestCooldown(army) + if army == -1 then + return "observer" + end + local brain = GetArmyBrain(army) - if army == -1 or brain:IsDefeated() then + + if brain:IsDefeated() then return "observer" end if ScenarioInfo.RecallDisabled then