From f22f495940b0a1fb6f882318e5d15e6d048bd961 Mon Sep 17 00:00:00 2001 From: jeefo Date: Sat, 1 Feb 2025 17:15:25 +0300 Subject: [PATCH] nav: avoid players that are in view cone only --- src/navigate.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/navigate.cpp b/src/navigate.cpp index 982501f..3e4bc27 100644 --- a/src/navigate.cpp +++ b/src/navigate.cpp @@ -533,12 +533,18 @@ void Bot::doPlayerAvoidance (const Vector &normal) { m_avoidAction = Dodge::None; return; } - else if (m_avoidAction != Dodge::None) { - if (m_avoidAction == Dodge::Left) { - setStrafeSpeed (normal, pev->maxspeed); + else { + if (util.getConeDeviation (ent (), m_hindrance->v.origin) < 0.8f) { + return; } - else if (m_avoidAction == Dodge::Right) { - setStrafeSpeed (normal, -pev->maxspeed); + + if (m_avoidAction != Dodge::None) { + if (m_avoidAction == Dodge::Left) { + setStrafeSpeed (normal, pev->maxspeed); + } + else if (m_avoidAction == Dodge::Right) { + setStrafeSpeed (normal, -pev->maxspeed); + } } } const float interval = m_frameInterval * (!isDucking () && pev->velocity.lengthSq2d () > 0.0f ? 6.0f : 2.0f);