void CNPC_Portal_FloorTurret::InactiveThink( void ) { LaserOff(); RopesOff(); // Update our PVS state CheckPVSCondition(); SetNextThink( gpGlobals->curtime + 1.0f ); // Wake up if we're not on our side if ( !OnSide() && VPhysicsGetObject()->GetContactPoint( NULL, NULL ) && m_bEnabled ) { // Never return to life! SetCollisionGroup( COLLISION_GROUP_NONE ); //ReturnToLife(); } else { IPhysicsObject *pTurretPhys = VPhysicsGetObject(); if ( !(pTurretPhys->GetGameFlags() & FVPHYSICS_PLAYER_HELD) && pTurretPhys->IsAsleep() ) SetCollisionGroup( COLLISION_GROUP_DEBRIS_TRIGGER ); else SetCollisionGroup( COLLISION_GROUP_NONE ); } }
//----------------------------------------------------------------------------- // Purpose: Allows a generic think function before the others are called // Input : state - which state the turret is currently in //----------------------------------------------------------------------------- bool CNPC_RocketTurret::PreThink( void ) { StudioFrameAdvance(); CheckPVSCondition(); //Do not interrupt current think function return false; }
//----------------------------------------------------------------------------- // Purpose: Allows a generic think function before the others are called // Input : state - which state the turret is currently in //----------------------------------------------------------------------------- bool CNPC_CeilingTurret::PreThink( turretState_e state ) { CheckPVSCondition(); //Animate StudioFrameAdvance(); //Do not interrupt current think function return false; }
//----------------------------------------------------------------------------- // Purpose: Allows a generic think function before the others are called // Input : state - which state the camera is currently in //----------------------------------------------------------------------------- bool CNPC_CombineCamera::PreThink(cameraState_e state) { CheckPVSCondition(); MaintainActivity(); StudioFrameAdvance(); // If we're disabled, shut down if ( !m_bEnabled ) { SetIdealActivity((Activity) ACT_COMBINE_CAMERA_CLOSED_IDLE); SetNextThink( gpGlobals->curtime + 0.1f ); return true; } // Do not interrupt current think function return false; }
//------------------------------------------------------------------------------ // Purpose : The main think function for the helicopters // Input : // Output : //------------------------------------------------------------------------------ void CBaseHelicopter::HelicopterThink( void ) { CheckPVSCondition(); SetNextThink( gpGlobals->curtime + HELICOPTER_THINK_INTERVAL ); // Don't keep this around for more than one frame. ClearCondition( COND_ENEMY_DEAD ); // Animate and dispatch animation events. StudioFrameAdvance( ); DispatchAnimEvents( this ); PrescheduleThink(); if ( IsMarkedForDeletion() ) return; ShowDamage( ); // ----------------------------------------------- // If AI is disabled, kill any motion and return // ----------------------------------------------- if (CAI_BaseNPC::m_nDebugBits & bits_debugDisableAI) { SetAbsVelocity( vec3_origin ); SetLocalAngularVelocity( vec3_angle ); SetNextThink( gpGlobals->curtime + HELICOPTER_THINK_INTERVAL ); return; } Hunt(); // Finally, forget dead enemies, or ones we've been told to ignore. if( GetEnemy() != NULL && (!GetEnemy()->IsAlive() || GetEnemy()->GetFlags() & FL_NOTARGET || IRelationType( GetEnemy() ) == D_NU ) ) { SetEnemy( NULL ); } HelicopterPostThink(); }