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: 11 additions & 8 deletions src/game/server/neo/bot/behavior/neo_bot_ctg_capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ CNEOBotCtgCapture::CNEOBotCtgCapture( CWeaponGhost *pObjective )
//---------------------------------------------------------------------------------------------
ActionResult<CNEOBot> CNEOBotCtgCapture::OnStart( CNEOBot *me, Action<CNEOBot> *priorAction )
{
m_captureAttemptTimer.Invalidate();
m_repathTimer.Invalidate();
m_path.Invalidate();
m_repathTimer.Invalidate();
m_captureAttemptTimer.Start( 3.0f );
m_previousKnownArea = me->GetLastKnownArea();

if ( !m_hObjective )
{
Expand Down Expand Up @@ -52,6 +53,14 @@ ActionResult<CNEOBot> CNEOBotCtgCapture::Update( CNEOBot *me, float interval )
return Done( "Ghost was taken by someone else" );
}

// Add more capture time if we progressed to the next NavArea
CNavArea *pCurrentKnownArea = me->GetLastKnownArea();
if ( pCurrentKnownArea != m_previousKnownArea )
{
m_captureAttemptTimer.Start( 3.0f );
m_previousKnownArea = pCurrentKnownArea;
}

if ( !m_repathTimer.HasStarted() || m_repathTimer.IsElapsed() )
{
if ( !CNEOBotPathCompute( me, m_path, m_hObjective->GetAbsOrigin(), FASTEST_ROUTE ) )
Expand All @@ -64,12 +73,6 @@ ActionResult<CNEOBot> CNEOBotCtgCapture::Update( CNEOBot *me, float interval )
}
m_path.Update( me );

if ( !m_captureAttemptTimer.HasStarted() )
{
// If this timer expires, give up
m_captureAttemptTimer.Start( 3.0f );
}

CBaseCombatWeapon *pPrimary = me->Weapon_GetSlot( 0 );
if ( pPrimary )
{
Expand Down
1 change: 1 addition & 0 deletions src/game/server/neo/bot/behavior/neo_bot_ctg_capture.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class CNEOBotCtgCapture : public Action<CNEOBot>

private:
CHandle<CWeaponGhost> m_hObjective;
CNavArea *m_previousKnownArea;
CountdownTimer m_captureAttemptTimer;
CountdownTimer m_repathTimer;
PathFollower m_path;
Expand Down