From bb34a09afe05d5e11888a7c06f41a0fc9dc93289 Mon Sep 17 00:00:00 2001 From: Fuzz Date: Tue, 20 Aug 2024 16:25:28 +1000 Subject: [PATCH] fixed bug I introduced in f87c87f5d4f5aefbf8db0a139d02b5989bf7b587 where bots wont dismount when they should --- src/strategy/actions/CheckMountStateAction.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/strategy/actions/CheckMountStateAction.cpp b/src/strategy/actions/CheckMountStateAction.cpp index 24684a6a..249b065f 100644 --- a/src/strategy/actions/CheckMountStateAction.cpp +++ b/src/strategy/actions/CheckMountStateAction.cpp @@ -132,11 +132,14 @@ bool CheckMountStateAction::isUseful() if (bot->HasUnitState(UNIT_STATE_IN_FLIGHT)) return false; - // checks both outdoors flag, and whether bot is clipping below floor slightly - // because that will cause bot to falsely indicate outdoors state and try - // mount indoors (seems to mostly be an issue in tunnels of WSG and AV) - if (!bot->IsOutdoors() || bot->GetPositionZ() < bot->GetMapWaterOrGroundLevel( - bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ())) + if (!bot->IsOutdoors()) + return false; + + // in addition to checking IsOutdoors, also check whether bot is clipping below floor slightly because that will + // cause bot to falsly indicate they are outdoors. This fixes bug where bot tries to mount indoors (which seems + // to mostly be an issue in tunnels of WSG and AV) + if (!bot->IsMounted() && bot->GetPositionZ() < bot->GetMapWaterOrGroundLevel( + bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ())) return false; if (bot->InArena())