22#include " bot/neo_bot.h"
33#include " bot/behavior/neo_bot_attack.h"
44#include " bot/behavior/neo_bot_ctg_lone_wolf_seek.h"
5+ #include " bot/behavior/neo_bot_seek_weapon.h"
56#include " bot/neo_bot_path_compute.h"
67#include " neo_gamerules.h"
78#include " neo_player.h"
@@ -75,6 +76,15 @@ class CSearchForUnexplored : public ISearchSurroundingAreasFunctor
7576 int m_iAreaLimit;
7677};
7778
79+ // ---------------------------------------------------------------------------------------------
80+ CNEOBotCtgLoneWolfSeek::CNEOBotCtgLoneWolfSeek ( void )
81+ {
82+ m_pIgnoredWeapons = std::make_unique<CNEOIgnoredWeaponsCache>();
83+ }
84+
85+ // ---------------------------------------------------------------------------------------------
86+ CNEOBotCtgLoneWolfSeek::~CNEOBotCtgLoneWolfSeek () = default ;
87+
7888// ---------------------------------------------------------------------------------------------
7989ActionResult< CNEOBot > CNEOBotCtgLoneWolfSeek::OnStart ( CNEOBot *me, Action< CNEOBot > *priorAction )
8090{
@@ -87,6 +97,9 @@ ActionResult< CNEOBot > CNEOBotCtgLoneWolfSeek::OnStart( CNEOBot *me, Action< CN
8797 m_vecLastGhostPos = NEORules ()->GetGhostPos ();
8898 m_pCachedGhostArea = TheNavMesh->GetNearestNavArea ( m_vecLastGhostPos );
8999
100+ m_scavengeTimer.Invalidate ();
101+ m_pIgnoredWeapons->Reset ();
102+
90103 return Continue ();
91104}
92105
@@ -133,6 +146,18 @@ ActionResult< CNEOBot > CNEOBotCtgLoneWolfSeek::Update( CNEOBot *me, float inter
133146 me->ReloadIfLowClip (true ); // force reload true
134147 }
135148
149+ // Periodically look for better weapons
150+ if ( ( !m_scavengeTimer.HasStarted () || m_scavengeTimer.IsElapsed () ) )
151+ {
152+ m_scavengeTimer.Start ( RandomFloat ( 3 .0f , 6 .0f ) );
153+
154+ CBaseEntity *pNearbyWeapon = FindNearestPrimaryWeapon ( me, true , m_pIgnoredWeapons.get () );
155+ if ( pNearbyWeapon )
156+ {
157+ return SuspendFor ( new CNEOBotSeekWeapon ( pNearbyWeapon, m_pIgnoredWeapons.get () ), " Scavenging for nearby weapon" );
158+ }
159+ }
160+
136161 Vector vecSoundPos = me->GetAudibleEnemySoundPos ();
137162 if ( vecSoundPos != CNEO_Player::VECTOR_INVALID_WAYPOINT )
138163 {
0 commit comments