//----------------------------------------------------------------------------- // Purpose: Static debug function to make all selected npcs run around // Input : // Output : //----------------------------------------------------------------------------- void CAI_BaseNPC::ForceSelectedGoRandom(void) { CAI_BaseNPC *npc = gEntList.NextEntByClass( (CAI_BaseNPC *)NULL ); while (npc) { if (npc->m_debugOverlays & OVERLAY_NPC_SELECTED_BIT) { // If a behavior is active, we need to stop running it npc->SetPrimaryBehavior( NULL ); npc->SetSchedule( SCHED_RUN_RANDOM ); npc->GetNavigator()->SetMovementActivity(ACT_RUN); } npc = gEntList.NextEntByClass(npc); } }
//----------------------------------------------------------------------------- // Purpose: Static debug function to force all selected npcs to go to the // given node // Input : // Output : //----------------------------------------------------------------------------- void CAI_BaseNPC::ForceSelectedGo(CBaseEntity *pPlayer, const Vector &targetPos, const Vector &traceDir, bool bRun) { CAI_BaseNPC *npc = gEntList.NextEntByClass( (CAI_BaseNPC *)NULL ); for ( ; npc; npc = gEntList.NextEntByClass(npc) ) { if ( ( npc->m_debugOverlays & OVERLAY_NPC_SELECTED_BIT ) == 0 ) continue; // If a behavior is active, we need to stop running it npc->SetPrimaryBehavior( NULL ); Vector chasePosition = targetPos; npc->TranslateNavGoal( pPlayer, chasePosition ); // It it legal to drop me here Vector vUpBit = chasePosition; vUpBit.z += 1; trace_t tr; AI_TraceHull( chasePosition, vUpBit, npc->GetHullMins(), npc->GetHullMaxs(), npc->GetAITraceMask(), npc, COLLISION_GROUP_NONE, &tr ); if (tr.startsolid || tr.fraction != 1.0 ) { NDebugOverlay::BoxAngles(chasePosition, npc->GetHullMins(), npc->GetHullMaxs(), npc->GetAbsAngles(), 255,0,0,20,0.5); } npc->m_vecLastPosition = chasePosition; if (npc->m_hCine != NULL) { npc->ExitScriptedSequence(); } npc->SetSchedule( bRun ? SCHED_FORCED_GO_RUN : SCHED_FORCED_GO ); npc->m_flMoveWaitFinished = gpGlobals->curtime; } }