Skip to content

Commit

Permalink
fix reversing-engineering mistake
Browse files Browse the repository at this point in the history
refactoring code
"bot_agressive" set default to 0
  • Loading branch information
Vaqtincha committed Jun 9, 2021
1 parent cc6337d commit f1be3c5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br/>`normal` default behaviour<br/>`fill` the server will adjust bots to keep `N` players in the game, where `N` is bot_quota<br/>`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.<br/>`0` disabled<br/>`1` enabled |
| bot_agressive | 1 | 0 | 2 | Bots can chastise friendly fire from humans.<br/>`0` disabled<br/>`1` only hunt due to teammate death<br/>`2` same as 1, but also when injuring |
| bot_agressive | 0 | 0 | 2 | Bots can chastise friendly fire from humans.<br/>`0` disabled<br/>`1` only hunt due to teammate death<br/>`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. <br/>`0` New behavior<br/>`1` Legacy behavior|
| mp_respawn_immunitytime | 0 | 0 | - | Specifies the players defense time after respawn. (in seconds).<br/>`0` disabled<br/>`>0.00001` time delay to remove protection |
Expand Down
4 changes: 2 additions & 2 deletions dist/game.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
33 changes: 17 additions & 16 deletions regamedll/dlls/bot/cs_bot_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CBasePlayer *>(pOther);
CBasePlayer *pKiller = static_cast<CBasePlayer *>(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));
Expand Down

0 comments on commit f1be3c5

Please sign in to comment.