@@ -20,6 +20,7 @@ CNEOBotCtgLoneWolf::CNEOBotCtgLoneWolf( void )
2020 m_bHasRetreatedFromGhost = false ;
2121 m_vecDropThreatPos = CNEO_Player::VECTOR_INVALID_WAYPOINT;
2222 m_closestCapturePoint = CNEO_Player::VECTOR_INVALID_WAYPOINT;
23+ m_pIgnoredWeapons = std::make_unique<CNEOIgnoredWeaponsCache>();
2324}
2425
2526// ---------------------------------------------------------------------------------------------
@@ -33,6 +34,8 @@ ActionResult< CNEOBot > CNEOBotCtgLoneWolf::OnStart( CNEOBot *me, Action< CNEOBo
3334 m_repathTimer.Invalidate ();
3435 m_stalemateTimer.Invalidate ();
3536 m_capPointUpdateTimer.Invalidate ();
37+ m_scavengeTimer.Invalidate ();
38+ m_pIgnoredWeapons->Reset ();
3639 m_vecDropThreatPos = CNEO_Player::VECTOR_INVALID_WAYPOINT;
3740 m_closestCapturePoint = CNEO_Player::VECTOR_INVALID_WAYPOINT;
3841 m_hPursueTarget = nullptr ;
@@ -59,7 +62,7 @@ ActionResult< CNEOBot > CNEOBotCtgLoneWolf::Update( CNEOBot *me, float interval
5962 // First, ensure we have a weapon.
6063 if ( !me->Weapon_GetSlot ( 0 ) )
6164 {
62- return SuspendFor ( new CNEOBotSeekWeapon (), " Scavenging for weapon to hunt threat" );
65+ return SuspendFor ( new CNEOBotSeekWeapon (nullptr , m_pIgnoredWeapons. get () ), " Scavenging for weapon to hunt threat" );
6366 }
6467
6568 // We have a weapon. Investigate the last known location.
@@ -204,22 +207,19 @@ ActionResult< CNEOBot > CNEOBotCtgLoneWolf::Update( CNEOBot *me, float interval
204207 else
205208 {
206209 // Enemy is closer to goal (blocking us) or gaining on us.
207-
208- // If we see a weapon nearby, drop the ghost and take it
209- CBaseEntity *pNearbyWeapon = FindNearestPrimaryWeapon ( me->GetAbsOrigin (), true );
210- if ( pNearbyWeapon )
210+ if ( m_scavengeTimer.IsElapsed () )
211211 {
212- CBaseCombatWeapon *pGhostWep = me->Weapon_GetSlot ( 0 );
213- if ( pGhostWep )
212+ m_scavengeTimer.Start ( RandomFloat ( 0 .5f , 1 .0f ) );
213+
214+ // If we see a weapon nearby, drop the ghost and take it
215+ CBaseEntity *pNearbyWeapon = FindNearestPrimaryWeapon ( me, true , m_pIgnoredWeapons.get () );
216+ if ( pNearbyWeapon )
214217 {
215- if ( me->GetActiveWeapon () != pGhostWep )
218+ CBaseCombatWeapon *pGhostWep = me->Weapon_GetSlot ( 0 );
219+ if ( pGhostWep )
216220 {
217- me->Weapon_Switch ( pGhostWep );
218- return Continue ();
221+ return SuspendFor ( new CNEOBotSeekWeapon ( pNearbyWeapon, m_pIgnoredWeapons.get () ), " Dropping ghost to scavenge nearby weapon" );
219222 }
220-
221- me->PressDropButton ( 0 .1f );
222- return ChangeTo ( new CNEOBotSeekWeapon (), " Dropping ghost to scavenge nearby weapon" );
223223 }
224224 }
225225
0 commit comments