Fix engineer bots softlocking on ctf

This commit is contained in:
AwfulRanger 2025-02-26 23:39:32 -05:00 committed by EricS-Valve
parent 3ae4d44b00
commit 65aa7c910e

View File

@ -29,7 +29,8 @@ ActionResult< CTFBot > CTFBotEngineerBuildTeleportEntrance::OnStart( CTFBot *me,
ActionResult< CTFBot > CTFBotEngineerBuildTeleportEntrance::Update( CTFBot *me, float interval ) ActionResult< CTFBot > CTFBotEngineerBuildTeleportEntrance::Update( CTFBot *me, float interval )
{ {
CTeamControlPoint *point = me->GetMyControlPoint(); CTeamControlPoint *point = me->GetMyControlPoint();
if ( !point ) CCaptureZone *zone = me->GetFlagCaptureZone();
if ( !point && !zone )
{ {
// wait until a control point becomes available // wait until a control point becomes available
return Continue(); return Continue();
@ -64,7 +65,14 @@ ActionResult< CTFBot > CTFBotEngineerBuildTeleportEntrance::Update( CTFBot *me,
if ( !m_path.IsValid() ) if ( !m_path.IsValid() )
{ {
CTFBotPathCost cost( me, FASTEST_ROUTE ); CTFBotPathCost cost( me, FASTEST_ROUTE );
m_path.Compute( me, point->GetAbsOrigin(), cost ); if ( point )
{
m_path.Compute( me, point->GetAbsOrigin(), cost );
}
else if ( zone )
{
m_path.Compute( me, zone->WorldSpaceCenter(), cost );
}
} }
m_path.Update( me ); m_path.Update( me );