From b77fae8a0e189ada861fd82a692d5702107c274b Mon Sep 17 00:00:00 2001 From: jeefo Date: Thu, 22 Feb 2024 00:36:46 +0300 Subject: [PATCH] nav: do not use 2d distance in node reachability checking nav: increase reachability distance for a goal on hostage rescue maps --- src/navigate.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/navigate.cpp b/src/navigate.cpp index 986eae4..a9ecd69 100644 --- a/src/navigate.cpp +++ b/src/navigate.cpp @@ -1078,7 +1078,7 @@ bool Bot::updateNavigation () { } float desiredDistanceSq = cr::sqrf (8.0f); - const float nodeDistanceSq = pev->origin.distanceSq2d (m_pathOrigin); + const float nodeDistanceSq = pev->origin.distanceSq (m_pathOrigin); // initialize the radius for a special node type, where the node is considered to be reached if (m_pathFlags & NodeFlag::Lift) { @@ -1086,6 +1086,11 @@ bool Bot::updateNavigation () { } else if (isDucking () || (m_pathFlags & NodeFlag::Goal)) { desiredDistanceSq = cr::sqrf (25.0f); + + // on cs_ maps goals are usually hostages, so increase reachability distance for them, they (hostages) picked anyway + if (game.mapIs (MapFlags::HostageRescue) && (m_pathFlags & NodeFlag::Goal)) { + desiredDistanceSq = cr::sqrf (128.0f); + } } else if (isOnLadder () || (m_pathFlags & NodeFlag::Ladder)) { desiredDistanceSq = cr::sqrf (24.0f);