Skip to content
Draft
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
24 changes: 18 additions & 6 deletions src/game/server/neo/bot/behavior/neo_bot_path_clear_breakable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ extern ConVar neo_bot_fire_weapon_allowed;
ConVar neo_bot_fire_at_breakable_weapon_min_time( "neo_bot_fire_at_breakable_weapon_min_time", "0.2", FCVAR_CHEAT,
"Minimum time to fire at breakables", true, 0.0f, true, 60.0f );

//--------------------------------------------------------------------------------------------------------
// A bot fights a threat in sight before it clears a breakable,
// but a ghost carrier does not attack, so waiting for the threat to leave keeps it stuck at the breakable
static bool IsHeldBackByThreat( const CNEOBot *me )
{
const CKnownEntity *threat = me->GetVisionInterface()->GetPrimaryKnownThreat();
if ( !threat || !threat->GetEntity() || !threat->IsVisibleRecently() )
{
return false;
}

return !me->IsCarryingGhost();
}

//--------------------------------------------------------------------------------------------------------
CBaseEntity *CNEOBotPathClearBreakable::GetBreakableInPath( CNEOBot *me )
{
Expand All @@ -27,9 +41,8 @@ CBaseEntity *CNEOBotPathClearBreakable::GetBreakableInPath( CNEOBot *me )
return nullptr;
}

// Only enter this behavior if there is no visible threat
const CKnownEntity *threat = me->GetVisionInterface()->GetPrimaryKnownThreat();
if ( threat && threat->GetEntity() && threat->IsVisibleRecently() )
// A threat in sight holds back any bot but a ghost carrier
if ( IsHeldBackByThreat( me ) )
{
return nullptr;
}
Expand Down Expand Up @@ -126,9 +139,8 @@ ActionResult< CNEOBot > CNEOBotPathClearBreakable::Update( CNEOBot *me, float in
return Done( "Freeze time" );
}

// If a visible threat appeared, bail out and let the normal combat system handle it
const CKnownEntity *threat = me->GetVisionInterface()->GetPrimaryKnownThreat();
if ( threat && threat->GetEntity() && threat->IsVisibleRecently() )
// A threat in sight holds back any bot but a ghost carrier
if ( IsHeldBackByThreat( me ) )
{
return Done( "Threat appeared" );
}
Expand Down
Loading