diff --git a/regamedll/dlls/bot/cs_bot_manager.cpp b/regamedll/dlls/bot/cs_bot_manager.cpp index 16714325..96714388 100644 --- a/regamedll/dlls/bot/cs_bot_manager.cpp +++ b/regamedll/dlls/bot/cs_bot_manager.cpp @@ -1500,3 +1500,23 @@ void CCSBotManager::ResetRadioMessageTimestamps() } } } + +void CCSBotManager::OnFreeEntPrivateData(CBaseEntity *pEntity) +{ + for (int i = 1; i <= gpGlobals->maxClients; i++) + { + CBasePlayer *pPlayer = UTIL_PlayerByIndex(i); + if (!pPlayer || pPlayer->IsDormant()) + continue; + + if (pPlayer->IsBot()) + { + CCSBot *pBot = static_cast(pPlayer); + if (pBot->m_attacker == pEntity) + pBot->m_attacker = NULL; + + if (pBot->m_bomber == pEntity) + pBot->m_bomber = NULL; + } + } +} diff --git a/regamedll/dlls/bot/cs_bot_manager.h b/regamedll/dlls/bot/cs_bot_manager.h index 685397f0..2eaeda7b 100644 --- a/regamedll/dlls/bot/cs_bot_manager.h +++ b/regamedll/dlls/bot/cs_bot_manager.h @@ -76,6 +76,7 @@ public: public: void ValidateMapData(); + void OnFreeEntPrivateData(CBaseEntity *pEntity); bool IsLearningMap() const { return IMPL(m_isLearningMap); } void SetLearningMapFlag() { IMPL(m_isLearningMap) = true; } bool IsAnalysisRequested() const { return IMPL(m_isAnalysisRequested); } diff --git a/regamedll/dlls/bot/states/cs_bot_attack.cpp b/regamedll/dlls/bot/states/cs_bot_attack.cpp index 4af030d9..f9fc5f5d 100644 --- a/regamedll/dlls/bot/states/cs_bot_attack.cpp +++ b/regamedll/dlls/bot/states/cs_bot_attack.cpp @@ -456,7 +456,6 @@ void AttackState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) if (gpGlobals->time > m_reacquireTimestamp) me->FireWeaponAtEnemy(); - // do dodge behavior // If sniping or crouching, stand still. if (m_dodge && !me->IsUsingSniperRifle() && !m_crouchAndHold) diff --git a/regamedll/dlls/cbase.cpp b/regamedll/dlls/cbase.cpp index 1b1f3a66..4710f597 100644 --- a/regamedll/dlls/cbase.cpp +++ b/regamedll/dlls/cbase.cpp @@ -1067,4 +1067,9 @@ void EXT_FUNC OnFreeEntPrivateData(edict_t *pEnt) } #endif +#ifdef REGAMEDLL_FIXES + if (TheCSBots()) { + TheCSBots()->OnFreeEntPrivateData(pEntity); + } +#endif }