From f1be3c5dbd674b089790e89a06dcfcfbb7377d41 Mon Sep 17 00:00:00 2001 From: Vaqtincha Date: Wed, 9 Jun 2021 23:34:30 +0500 Subject: [PATCH] fix reversing-engineering mistake refactoring code "bot_agressive" set default to 0 --- README.md | 2 +- dist/game.cfg | 4 ++-- regamedll/dlls/bot/cs_bot_event.cpp | 33 +++++++++++++++-------------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 95230305a..f15c4981d 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab | bot_quota_mode | normal | - | - | Determines the type of quota.
`normal` default behaviour
`fill` the server will adjust bots to keep `N` players in the game, where `N` is bot_quota
`match` the server will maintain a `1:N` ratio of humans to bots, where `N` is bot_quota | | bot_join_delay | 0 | - | - | Prevents bots from joining the server for this many seconds after a map change. | | bot_freeze | 0 | 0 | 1 | Prevents bots on your server from moving.
`0` disabled
`1` enabled | -| bot_agressive | 1 | 0 | 2 | Bots can chastise friendly fire from humans.
`0` disabled
`1` only hunt due to teammate death
`2` same as 1, but also when injuring | +| bot_agressive | 0 | 0 | 2 | Bots can chastise friendly fire from humans.
`0` disabled
`1` only hunt due to teammate death
`2` same as 1, but also when injuring | | mp_item_staytime | 300 | - | - | Time to remove item that have been dropped from the players. | | mp_legacy_bombtarget_touch | 1 | 0 | 1 | Legacy func_bomb_target touch. New one is more strict.
`0` New behavior
`1` Legacy behavior| | mp_respawn_immunitytime | 0 | 0 | - | Specifies the players defense time after respawn. (in seconds).
`0` disabled
`>0.00001` time delay to remove protection | diff --git a/dist/game.cfg b/dist/game.cfg index 36d2c0702..a6f21e910 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -212,8 +212,8 @@ bot_freeze 0 // 1 - only hunt due to teammate death (default behavior) // 2 - same as 1, but also when injuring // -// Default value: "1" -bot_agressive 1 +// Default value: "0" +bot_agressive 0 // Debug cvar shows triggers. // 0 - disabled (default behaviour) diff --git a/regamedll/dlls/bot/cs_bot_event.cpp b/regamedll/dlls/bot/cs_bot_event.cpp index 739450d20..d4c98b830 100644 --- a/regamedll/dlls/bot/cs_bot_event.cpp +++ b/regamedll/dlls/bot/cs_bot_event.cpp @@ -67,31 +67,32 @@ void CCSBot::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOt // automatically acquire our dead friend's killer if (!IsAttacking() && (GetDisposition() == ENGAGE_AND_INVESTIGATE || GetDisposition() == OPPORTUNITY_FIRE)) { - if (event == EVENT_PLAYER_DIED + if ((event == EVENT_PLAYER_DIED #ifdef REGAMEDLL_ADD - || event == EVENT_PLAYER_TOOK_DAMAGE + && + cv_bot_agressive.value == 0) || + (cv_bot_agressive.value == 1 && event == EVENT_PLAYER_DIED) || + (cv_bot_agressive.value == 2 && event == EVENT_PLAYER_TOOK_DAMAGE #endif - ) + )) { - if (BotRelationship(pPlayer) == BOT_TEAMMATE) + CBasePlayer *pVictim = pPlayer; + if (BotRelationship(pVictim) == BOT_TEAMMATE) { -#ifdef REGAMEDLL_ADD - if ((event == EVENT_PLAYER_DIED && cv_bot_agressive.value != 0) || (event == EVENT_PLAYER_TOOK_DAMAGE && cv_bot_agressive.value > 1)) -#endif - { - CBasePlayer *pKiller = static_cast(pOther); + CBasePlayer *pKiller = static_cast(pOther); - // check that attacker is an enemy (for friendly fire, etc) - if (pKiller && pKiller->IsPlayer() -#ifdef REGAMEDLL_FIXES - // why should they kill each other because of aggression - && !pKiller->IsBot() + // check that attacker is an enemy (for friendly fire, etc) + if (pKiller && pKiller->IsPlayer() && !pKiller->IsBot()) + { + if ( +#ifdef REGAMEDLL_ADD + cv_bot_agressive.value > 0 || #endif - ) + BotRelationship(pKiller) == BOT_ENEMY) { // check if we saw our friend die - dont check FOV - assume we're aware of our surroundings in combat // snipers stay put - if (!IsSniper() && IsVisible(&pPlayer->pev->origin)) + if (!IsSniper() && IsVisible(&pVictim->pev->origin)) { // people are dying - we should hurry Hurry(RANDOM_FLOAT(10.0f, 15.0f));