Skip to content

Commit 1da5206

Browse files
authored
Increase recon bot super jump distance planning threshold (#1899)
Also misc bot_behavior implementation cleanup.
1 parent 52e62ee commit 1da5206

3 files changed

Lines changed: 13 additions & 15 deletions

File tree

src/game/server/neo/bot/behavior/neo_bot_behavior.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ ConVar neo_bot_fire_weapon_allowed( "neo_bot_fire_weapon_allowed", "1", FCVAR_CH
3636

3737
ConVar neo_bot_allow_retreat( "neo_bot_allow_retreat", "1", FCVAR_CHEAT, "If zero, bots will not attempt to retreat if they are are in a bad situation." );
3838

39-
ConVar neo_bot_recon_superjump_min_dist( "neo_bot_recon_superjump_min_dist", "1000", FCVAR_NONE,
39+
ConVar neo_bot_recon_superjump_min_dist( "neo_bot_recon_superjump_min_dist", "4096", FCVAR_NONE,
4040
"Minimum straight-line path distance required for a Recon bot to super jump while moving", true, 0, false, 0 );
4141

42-
ConVar neo_bot_recon_superjump_min_accuracy( "neo_bot_recon_superjump_min_accuracy", "0.95", FCVAR_NONE,
42+
ConVar neo_bot_recon_superjump_min_accuracy( "neo_bot_recon_superjump_min_accuracy", "0.96", FCVAR_NONE,
4343
"Minimum directional alignment with path required for a Recon bot to super jump while moving", true, 0.1f, false, 1.0f );
4444

4545
//---------------------------------------------------------------------------------------------
@@ -370,30 +370,30 @@ Vector CNEOBotMainAction::SelectTargetPoint( const INextBot *meBot, const CBaseC
370370
//-----------------------------------------------------------------------------------------
371371
void CNEOBotMainAction::ReconConsiderSuperJump( CNEOBot *me )
372372
{
373-
CNEO_Player *pNeoMe = ToNEOPlayer(me);
374-
if ( !pNeoMe || pNeoMe->GetClass() != NEO_CLASS_RECON )
373+
if ( me->GetClass() != NEO_CLASS_RECON )
375374
{
376375
return;
377376
}
378377

379378
// Check that bot isn't only moving sideways which wastes aux power
380379
// Also determines a direction to jump towards
381380
// NEO Jank: We don't check sprint here because bots don't anticipate using sprint in a smart manner
382-
if ( ( pNeoMe->m_nButtons & ( IN_FORWARD | IN_BACK ) ) == 0 )
381+
const int nForwardBack = me->m_nButtons & ( IN_FORWARD | IN_BACK );
382+
if ( nForwardBack == 0 || nForwardBack == ( IN_FORWARD | IN_BACK ) )
383383
{
384384
// Remove this check if we add sideways super jump in the future
385385
return;
386386
}
387387

388-
if (!pNeoMe->IsAllowedToSuperJump())
388+
if (!me->IsAllowedToSuperJump())
389389
{
390390
return;
391391
}
392392

393-
bool bImmediateDanger = gpGlobals->curtime - pNeoMe->GetLastDamageTime() <= 2.0f;
393+
bool bImmediateDanger = gpGlobals->curtime - me->GetLastDamageTime() <= 2.0f;
394394

395395
if (!bImmediateDanger
396-
&& (pNeoMe->m_nButtons & IN_FORWARD)
396+
&& (me->m_nButtons & IN_FORWARD)
397397
&& (neo_bot_recon_superjump_min_dist.GetFloat() > 1))
398398
{
399399
if (!m_reconSuperJumpPathCheckTimer.IsElapsed())
@@ -421,7 +421,7 @@ void CNEOBotMainAction::ReconConsiderSuperJump( CNEOBot *me )
421421

422422
// Get the bot's facing direction
423423
Vector vecFacing;
424-
pNeoMe->EyeVectors( &vecFacing );
424+
me->EyeVectors( &vecFacing );
425425
vecFacing.z = 0.0f;
426426
vecFacing.NormalizeInPlace();
427427

@@ -455,7 +455,7 @@ void CNEOBotMainAction::ReconConsiderSuperJump( CNEOBot *me )
455455
}
456456

457457
// Sanity check that each waypoint is relatively aligned with our jump direction
458-
Vector vecToWaypoint = seg->pos - pNeoMe->GetAbsOrigin();
458+
Vector vecToWaypoint = seg->pos - me->GetAbsOrigin();
459459
vecToWaypoint.z = 0.0f;
460460

461461
float flDist = vecToWaypoint.NormalizeInPlace();
@@ -470,7 +470,7 @@ void CNEOBotMainAction::ReconConsiderSuperJump( CNEOBot *me )
470470
bCanJump = true;
471471
break;
472472
}
473-
else if (flDist < 0)
473+
else if ( !IsFinite( flDist ) || flDist < 0 )
474474
{
475475
return; // Just in case of a bad value
476476
}

src/game/server/neo/bot/behavior/neo_bot_tactical_monitor.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,7 @@ ActionResult< CNEOBot > CNEOBotTacticalMonitor::Update( CNEOBot *me, float inter
295295
MonitorArmedStickyBombs( me );
296296
#endif
297297

298-
CNEO_Player* pBotPlayer = ToNEOPlayer( me->GetEntity() );
299-
if ( pBotPlayer && !(pBotPlayer->m_nButtons & (IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_USE)) )
298+
if ( !(me->m_nButtons & (IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_USE)) )
300299
{
301300
AvoidBumpingFriends( me );
302301
}

src/game/server/neo/bot/neo_bot.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,8 +1620,7 @@ void CNEOBot::ReloadIfLowClip(bool bForceReload)
16201620
}
16211621
else if (myWeapon->Clip1() > 0)
16221622
{
1623-
auto* pPlayer = ToNEOPlayer(this);
1624-
if ( pPlayer->GetTimeSinceWeaponFired() < 3.0f)
1623+
if (GetTimeSinceWeaponFired() < 3.0f)
16251624
{
16261625
return; // still in the middle of a fight
16271626
}

0 commit comments

Comments
 (0)