@@ -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 ;
@@ -62,7 +65,7 @@ ActionResult< CNEOBot > CNEOBotCtgLoneWolf::Update( CNEOBot *me, float interval
6265 // First, ensure we have a weapon.
6366 if ( !me->Weapon_GetSlot ( 0 ) )
6467 {
65- return SuspendFor ( new CNEOBotSeekWeapon (), " Scavenging for weapon to hunt threat" );
68+ return SuspendFor ( new CNEOBotSeekWeapon (nullptr , m_pIgnoredWeapons. get () ), " Scavenging for weapon to hunt threat" );
6669 }
6770
6871 // We have a weapon. Investigate the last known location.
@@ -207,22 +210,19 @@ ActionResult< CNEOBot > CNEOBotCtgLoneWolf::Update( CNEOBot *me, float interval
207210 else
208211 {
209212 // Enemy is closer to goal (blocking us) or gaining on us.
210-
211- // If we see a weapon nearby, drop the ghost and take it
212- CBaseEntity *pNearbyWeapon = FindNearestPrimaryWeapon ( me->GetAbsOrigin (), true );
213- if ( pNearbyWeapon )
213+ if ( m_scavengeTimer.IsElapsed () )
214214 {
215- CBaseCombatWeapon *pGhostWep = me->Weapon_GetSlot ( 0 );
216- if ( pGhostWep )
215+ m_scavengeTimer.Start ( RandomFloat ( 0 .5f , 1 .0f ) );
216+
217+ // If we see a weapon nearby, drop the ghost and take it
218+ CBaseEntity *pNearbyWeapon = FindNearestPrimaryWeapon ( me, true , m_pIgnoredWeapons.get () );
219+ if ( pNearbyWeapon )
217220 {
218- if ( me->GetActiveWeapon () != pGhostWep )
221+ CBaseCombatWeapon *pGhostWep = me->Weapon_GetSlot ( 0 );
222+ if ( pGhostWep )
219223 {
220- me->Weapon_Switch ( pGhostWep );
221- return Continue ();
224+ return SuspendFor ( new CNEOBotSeekWeapon ( pNearbyWeapon, m_pIgnoredWeapons.get () ), " Dropping ghost to scavenge nearby weapon" );
222225 }
223-
224- me->PressDropButton ( 0 .1f );
225- return ChangeTo ( new CNEOBotSeekWeapon (), " Dropping ghost to scavenge nearby weapon" );
226226 }
227227 }
228228
0 commit comments