From 07a8a5c81ebc13b3e5438812991f314b1945221b Mon Sep 17 00:00:00 2001 From: commandcobra7 <91374215+commandcobra7@users.noreply.github.com> Date: Tue, 13 Sep 2022 10:57:59 +0300 Subject: [PATCH] fix: bots do not look at the wall while camping. (solves #303) --- src/botlib.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/botlib.cpp b/src/botlib.cpp index 919ffb1..7dfa2c6 100644 --- a/src/botlib.cpp +++ b/src/botlib.cpp @@ -3687,7 +3687,16 @@ void Bot::camp_ () { } } else { - m_camp = graph[findCampingDirection ()].origin; + if (!game.isNullEntity (m_lastEnemy)) { + auto lastEnemyNearestIndex = graph.getNearest (m_lastEnemy->v.origin); + + if (!util.isAlive (m_lastEnemy) && rg.get (1, 3) == 1 && graph.isVisible (m_currentNodeIndex, lastEnemyNearestIndex)) { + m_camp = graph[lastEnemyNearestIndex].origin; + } + } + else { + m_camp = graph[findCampingDirection ()].origin; + } } } // press remembered crouch button