From e753efd6787638af9183d3070efd555205a00756 Mon Sep 17 00:00:00 2001 From: jeefo Date: Sun, 10 Sep 2023 11:10:31 +0300 Subject: [PATCH] nav: allow to disable player avoidance via yb_has_team_semiclip cvar (ref #478) --- inc/engine.h | 6 +++--- src/navigate.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/inc/engine.h b/inc/engine.h index 5b1555f..b48799b 100644 --- a/inc/engine.h +++ b/inc/engine.h @@ -602,7 +602,7 @@ public: public: template T read () { T result {}; - auto size = sizeof (T); + constexpr auto size = sizeof (T); if (m_cursor + size > m_buffer.length ()) { return 0; @@ -616,12 +616,12 @@ public: // must be called right after read template void write (T value) { - auto size = sizeof (value); + constexpr auto size = sizeof (value); memcpy (m_buffer.data () + m_cursor - size, &value, size); } template void skip () { - auto size = sizeof (T); + constexpr auto size = sizeof (T); if (m_cursor + size > m_buffer.length ()) { return; diff --git a/src/navigate.cpp b/src/navigate.cpp index 4f9c5fe..11f2511 100644 --- a/src/navigate.cpp +++ b/src/navigate.cpp @@ -7,6 +7,8 @@ #include +ConVar cv_has_team_semiclip ("has_team_semiclip", "0", "When enabled, bots will not try to avoid teammates on their way. Assuming some of the semiclip plugins are in use."); + int Bot::findBestGoal () { if (m_isCreature) { if (!graph.m_terrorPoints.empty ()) { @@ -422,6 +424,10 @@ void Bot::ignoreCollision () { } void Bot::doPlayerAvoidance (const Vector &normal) { + if (cv_has_team_semiclip.bool_ ()) { + return; // no player avoiding when with semiclip plugin + } + m_hindrance = nullptr; float distanceSq = cr::sqrf (348.0f);