From 19c5e6dd4d7884b6d898d5f1bf44c7ee1eaa687b Mon Sep 17 00:00:00 2001 From: jeefo Date: Sat, 25 Mar 2023 05:01:58 +0300 Subject: [PATCH] fix: do rotation instantly, and not on round start so it works on infinite round like in csdm --- inc/yapb.h | 1 + src/botlib.cpp | 8 ++++++++ src/manager.cpp | 8 -------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/inc/yapb.h b/inc/yapb.h index 346a42a..1cb84b4 100644 --- a/inc/yapb.h +++ b/inc/yapb.h @@ -1190,6 +1190,7 @@ extern ConVar cv_debug; extern ConVar cv_debug_goal; extern ConVar cv_save_bots_names; extern ConVar cv_random_knife_attacks; +extern ConVar cv_rotate_bots; extern ConVar mp_freezetime; extern ConVar mp_roundtime; diff --git a/src/botlib.cpp b/src/botlib.cpp index 1640e20..1e214a2 100644 --- a/src/botlib.cpp +++ b/src/botlib.cpp @@ -3001,6 +3001,14 @@ void Bot::frame () { showChaterIcon (false); // end voice feedback } + // kick the bot if stay time is over, the quota maintain will add new bot for us later + if (cv_rotate_bots.bool_ () && m_stayTime < game.time ()) { + m_kickedByRotation = true; // kicked by roration, so not save bot name if save bot names is active + + kick (); + return; + } + // clear enemy far away if (!m_lastEnemyOrigin.empty () && !game.isNullEntity (m_lastEnemy) && pev->origin.distanceSq (m_lastEnemyOrigin) >= cr::square (1600.0f)) { m_lastEnemy = nullptr; diff --git a/src/manager.cpp b/src/manager.cpp index df23327..739fa38 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -1236,14 +1236,6 @@ void BotManager::handleDeath (edict_t *killer, edict_t *victim) { void Bot::newRound () { // this function initializes a bot after creation & at the start of each round - // kick the bot if stay time is over, the quota maintain will add new bot for us later - if (cv_rotate_bots.bool_ () && m_stayTime < game.time ()) { - m_kickedByRotation = true; // kicked by roration, so not save bot name if save bot names is active - - kick (); - return; - } - // delete all allocated path nodes clearSearchNodes (); clearRoute ();