Skip to content

Commit c6fad9b

Browse files
committed
Lone bots deploy detpack ambush at ghost
Overhaul lone wolf behaviors based around search Fix drop weapon to capture and immediately cancel loop Code review feedback pass Equip firearm when investigating
1 parent eb8f4e6 commit c6fad9b

21 files changed

Lines changed: 1496 additions & 411 deletions

src/game/server/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,8 +1580,18 @@ target_sources_grouped(
15801580
neo/bot/behavior/neo_bot_ctg_enemy.h
15811581
neo/bot/behavior/neo_bot_ctg_escort.h
15821582
neo/bot/behavior/neo_bot_ctg_lone_wolf.h
1583+
neo/bot/behavior/neo_bot_ctg_lone_wolf_ambush.cpp
1584+
neo/bot/behavior/neo_bot_ctg_lone_wolf_ambush.h
1585+
neo/bot/behavior/neo_bot_ctg_lone_wolf_seek.cpp
1586+
neo/bot/behavior/neo_bot_ctg_lone_wolf_seek.h
1587+
neo/bot/behavior/neo_bot_ctg_seek.cpp
15831588
neo/bot/behavior/neo_bot_ctg_seek.h
15841589
neo/bot/behavior/neo_bot_dead.h
1590+
neo/bot/behavior/neo_bot_detpack_deploy.cpp
1591+
neo/bot/behavior/neo_bot_detpack_deploy.h
1592+
neo/bot/behavior/neo_bot_detpack_trigger.cpp
1593+
neo/bot/behavior/neo_bot_detpack_trigger.h
1594+
neo/bot/behavior/neo_bot_grenade_dispatch.cpp
15851595
neo/bot/behavior/neo_bot_grenade_dispatch.h
15861596
neo/bot/behavior/neo_bot_grenade_throw.h
15871597
neo/bot/behavior/neo_bot_grenade_throw_frag.h

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include "cbase.h"
22
#include "bot/behavior/neo_bot_ctg_capture.h"
3+
#include "bot/behavior/neo_bot_ctg_lone_wolf_seek.h"
34
#include "bot/behavior/neo_bot_seek_weapon.h"
45
#include "bot/neo_bot_path_compute.h"
6+
#include "neo_detpack.h"
57
#include "weapon_ghost.h"
68

79

@@ -67,6 +69,31 @@ ActionResult<CNEOBot> CNEOBotCtgCapture::Update( CNEOBot *me, float interval )
6769
m_captureAttemptTimer.Start( 3.0f );
6870
}
6971

72+
// Check if there is a detpack that risks exploding if I pick up the ghost
73+
// NEO Jank: It may be more proper to check for line of sight,
74+
// but triggering an entity search at the last moment may involve fewer overall calculations
75+
// with the lampshade explanation as the bot being able to notice the detpack along the path
76+
// even if we didn't check constantly along the same path
77+
CBaseEntity *pEnts[256];
78+
int numEnts = UTIL_EntitiesInSphere( pEnts, 256, me->GetAbsOrigin(), NEO_DETPACK_DAMAGE_RADIUS, 0 );
79+
bool bDetpackNear = false;
80+
for ( int i = 0; i < numEnts; ++i )
81+
{
82+
if ( pEnts[i] && FClassnameIs( pEnts[i], "neo_deployed_detpack" ) )
83+
{
84+
bDetpackNear = true;
85+
break;
86+
}
87+
}
88+
89+
if ( bDetpackNear )
90+
{
91+
// NEO JANK: Putting the bot into seek mode will have it search the map for enemies for the rest of the round
92+
// but for now this could be fine as it may indicate an entrenched enemy
93+
// or a friendly that is setting up an ambush, where either scenario indicates ghost capture is too dangerous
94+
return ChangeTo( new CNEOBotCtgLoneWolfSeek(), "Found detpack: skipping ghost capture to search for enemies" );
95+
}
96+
7097
CBaseCombatWeapon *pPrimary = me->Weapon_GetSlot( 0 );
7198
if ( pPrimary )
7299
{

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "bot/behavior/neo_bot_ctg_carrier.h"
55
#include "bot/behavior/neo_bot_ctg_lone_wolf.h"
66
#include "bot/neo_bot_path_compute.h"
7+
#include "nav_mesh.h"
78
#include "neo_gamerules.h"
89
#include "neo_ghost_cap_point.h"
910
#include "debugoverlay_shared.h"
@@ -384,9 +385,26 @@ ActionResult< CNEOBot > CNEOBotCtgCarrier::Update( CNEOBot *me, float interval )
384385
m_teammates.RemoveAll();
385386
CollectPlayers( me, &m_teammates );
386387

388+
// Check if bot should transition into lone wolf behavior
387389
if ( m_teammates.Count() == 0 )
388390
{
389-
return SuspendFor( new CNEOBotCtgLoneWolf, "I'm the last one!" );
391+
const CKnownEntity *threat = me->GetVisionInterface()->GetPrimaryKnownThreat( true );
392+
if ( threat && threat->GetEntity() && threat->GetEntity()->IsAlive() )
393+
{
394+
CNavArea *destArea = TheNavMesh->GetNearestNavArea( m_closestCapturePoint );
395+
CNavArea *myArea = me->GetLastKnownArea();
396+
397+
if ( !destArea || !myArea || !destArea->IsPotentiallyVisible( myArea ) )
398+
{
399+
return SuspendFor( new CNEOBotCtgLoneWolf, "Last one standing and blocked from capturing!" );
400+
}
401+
}
402+
403+
// Lone wolf will drop the ghost and go into enemy seeking behavior
404+
if ( m_closestCapturePoint == CNEO_Player::VECTOR_INVALID_WAYPOINT )
405+
{
406+
return SuspendFor( new CNEOBotCtgLoneWolf, "Looking for enemy since there is no capture point" );
407+
}
390408
}
391409

392410
UpdateFollowPath( me, m_teammates );

0 commit comments

Comments
 (0)