From f87c87f5d4f5aefbf8db0a139d02b5989bf7b587 Mon Sep 17 00:00:00 2001 From: Fuzz Date: Thu, 15 Aug 2024 21:26:09 +1000 Subject: [PATCH] fix for bots trying to mount in WSG and AV tunnels --- src/strategy/actions/CheckMountStateAction.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/strategy/actions/CheckMountStateAction.cpp b/src/strategy/actions/CheckMountStateAction.cpp index d85f51b50..24684a6a1 100644 --- a/src/strategy/actions/CheckMountStateAction.cpp +++ b/src/strategy/actions/CheckMountStateAction.cpp @@ -129,11 +129,14 @@ bool CheckMountStateAction::isUseful() if (bot->isDead()) return false; - bool isOutdoor = bot->IsOutdoors(); - if (!isOutdoor) + if (bot->HasUnitState(UNIT_STATE_IN_FLIGHT)) return false; - if (bot->HasUnitState(UNIT_STATE_IN_FLIGHT)) + // 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())) return false; if (bot->InArena())