diff --git a/src/game/server/neo/bot/behavior/neo_bot_path_clear_breakable.cpp b/src/game/server/neo/bot/behavior/neo_bot_path_clear_breakable.cpp index 59c45f1271..0c9d9e1824 100644 --- a/src/game/server/neo/bot/behavior/neo_bot_path_clear_breakable.cpp +++ b/src/game/server/neo/bot/behavior/neo_bot_path_clear_breakable.cpp @@ -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 ) { @@ -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; } @@ -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" ); }