Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/game/server/tf/bot/tf_bot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4989,3 +4989,22 @@ float CTFBot::GetUberDeployDelayDuration()

return -1.f;
}

bool CTFBot::IsEnemy( const CBaseEntity *them ) const
{
if ( them == NULL )
return false;

int theirTeamNum = them->GetTeamNumber();

// Check if a truce is active, as this will make enemy players no longer an "enemy" as they cannot be damaged during this state.
if ( TFGameRules() && TFGameRules()->IsTruceActive() )
{
return theirTeamNum != TF_TEAM_BLUE && theirTeamNum != TF_TEAM_RED;
}
else
{
// this is not strictly correct, as spectators are not enemies
return ( ( INextBot * ) this )->GetEntity()->GetTeamNumber() != theirTeamNum;
}
}
1 change: 1 addition & 0 deletions src/game/server/tf/bot/tf_bot.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ class CTFBot: public NextBotPlayer< CTFPlayer >, public CGameEventListener

bool ShouldReEvaluateCurrentClass( void ) const;
void ReEvaluateCurrentClass( void );
bool IsEnemy( const CBaseEntity* ) const;

private:
CTFBotLocomotion *m_locomotor;
Expand Down