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
23 changes: 23 additions & 0 deletions src/game/server/neo/bot/behavior/neo_bot_command_follow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ CNEOBotCommandFollow::CNEOBotCommandFollow() : m_vGoalPos( CNEO_Player::VECTOR_I
//---------------------------------------------------------------------------------------------
ActionResult< CNEOBot > CNEOBotCommandFollow::OnStart(CNEOBot *me, Action< CNEOBot > *priorAction)
{
SendUpdateToCommander( me, "Joining your squad." );
m_path.SetMinLookAheadDistance(me->GetDesiredPathLookAheadRange());
m_commanderLookingAtMeTimer.Invalidate();
m_bWasCommanderLookingAtMe = false;
Expand All @@ -59,6 +60,7 @@ ActionResult< CNEOBot > CNEOBotCommandFollow::Update(CNEOBot *me, float interval
ActionResult<CNEOBot> weaponRequestResult = CheckCommanderWeaponRequest(me);
if (weaponRequestResult.IsRequestingChange())
{
SendUpdateToCommander( me, "Here, take this." );
return weaponRequestResult;
}

Expand Down Expand Up @@ -223,6 +225,11 @@ bool CNEOBotCommandFollow::FollowCommandChain(CNEOBot* me)
&& (me->GetStar() == pCommander->GetStar()) // only follow when commander is focused on your squad
&& (me->GetAbsOrigin().DistToSqr(pCommander->GetAbsOrigin()) < sv_neo_bot_cmdr_stop_distance_sq.GetFloat()))
{
if ( !me->m_hLeadingPlayer.Get() )
{
SendUpdateToCommander( me, "Following you." );
}

// Use sv_neo_bot_cmdr_stop_distance_sq for consistent bot collection range
// follow_stop_distance_sq would be confusing if player doesn't know about distance tuning
me->m_hLeadingPlayer = pCommander;
Expand All @@ -235,6 +242,7 @@ bool CNEOBotCommandFollow::FollowCommandChain(CNEOBot* me)
// Check if there's been an update for this star's ping waypoint
if (pCommander->m_vLastPingByStar.Get(me->GetStar()) != me->m_vLastPingByStar.Get(me->GetStar()))
{
SendUpdateToCommander( me, "On my way." );
me->m_hLeadingPlayer = nullptr; // Stop following and start travelling to ping
m_vGoalPos = pCommander->m_vLastPingByStar.Get(me->GetStar());
me->m_vLastPingByStar.GetForModify(me->GetStar()) = pCommander->m_vLastPingByStar.Get(me->GetStar());
Expand Down Expand Up @@ -459,3 +467,18 @@ bool CNEOBotCommandFollow::FanOutAndCover(CNEOBot* me, Vector& movementTarget, b
// Still moving to destination, path will be recomputed by the calling context
return false;
}

//---------------------------------------------------------------------------------------------
void CNEOBotCommandFollow::SendUpdateToCommander( CNEOBot *me, const char *message )
{
CNEO_Player *pCommander = me->m_hCommandingPlayer.Get();
if ( pCommander && pCommander->IsNetClient() )
{
CSingleUserRecipientFilter user( pCommander );
user.MakeReliable();

char szText[256];
V_snprintf( szText, sizeof( szText ), "%s: %s\n", me->GetNeoPlayerName(), message );
UTIL_SayTextFilter( user, szText, me, true );
}
}
1 change: 1 addition & 0 deletions src/game/server/neo/bot/behavior/neo_bot_command_follow.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CNEOBotCommandFollow : public Action< CNEOBot >
bool FollowCommandChain( CNEOBot *me );
bool FanOutAndCover( CNEOBot *me, Vector &movementTarget, bool bMoveToSeparate = true, float flArrivalZoneSizeSq = -1.0f );
ActionResult< CNEOBot > CheckCommanderWeaponRequest( CNEOBot *me );
void SendUpdateToCommander( CNEOBot *me, const char *message );

PathFollower m_path;
CountdownTimer m_repathTimer;
Expand Down
Loading