From 5287f2a4150ed128e7951fc02ba32a184ed6684b Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 31 Jan 2024 19:16:37 +0700 Subject: [PATCH] Do not reduce points for bot suicide due bot_kill command --- regamedll/dlls/bot/cs_bot.cpp | 14 ++++++++++++++ regamedll/dlls/bot/cs_bot.h | 4 ++++ regamedll/dlls/bot/cs_bot_manager.cpp | 5 ++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/regamedll/dlls/bot/cs_bot.cpp b/regamedll/dlls/bot/cs_bot.cpp index b0a48472..838387a9 100644 --- a/regamedll/dlls/bot/cs_bot.cpp +++ b/regamedll/dlls/bot/cs_bot.cpp @@ -429,6 +429,20 @@ bool CCSBot::StayOnNavMesh() return false; } +#ifdef REGAMEDLL_FIXES +void CCSBot::Kill() +{ + m_LastHitGroup = HITGROUP_GENERIC; + + // have the player kill himself + pev->health = 0.0f; + Killed(VARS(eoNullEntity), GIB_NEVER); + + if (CSGameRules()->m_pVIP == this) + CSGameRules()->m_iConsecutiveVIP = 10; +} +#endif + void CCSBot::Panic(CBasePlayer *pEnemy) { if (IsSurprised()) diff --git a/regamedll/dlls/bot/cs_bot.h b/regamedll/dlls/bot/cs_bot.h index 345e11fb..9670744f 100644 --- a/regamedll/dlls/bot/cs_bot.h +++ b/regamedll/dlls/bot/cs_bot.h @@ -375,6 +375,10 @@ public: bool IsBuying() const; +#ifdef REGAMEDLL_FIXES + void Kill(); +#endif + void Panic(CBasePlayer *pEnemy); // look around in panic void Follow(CBasePlayer *pPlayer); // begin following given Player void ContinueFollowing(); // continue following our leader after finishing what we were doing diff --git a/regamedll/dlls/bot/cs_bot_manager.cpp b/regamedll/dlls/bot/cs_bot_manager.cpp index 345ae31f..78ce0cf5 100644 --- a/regamedll/dlls/bot/cs_bot_manager.cpp +++ b/regamedll/dlls/bot/cs_bot_manager.cpp @@ -408,10 +408,9 @@ void CCSBotManager::ServerCommand(const char *pcmd) if (pPlayer->IsBot()) { + CCSBot *pBot = static_cast(pPlayer); if (killThemAll || FStrEq(name, msg)) - { - pPlayer->Kill(); - } + pBot->Kill(); } } }