//----------------------------------------------------------------------------- // Purpose: // Input : *pTask - //----------------------------------------------------------------------------- void CAI_RappelBehavior::RunTask( const Task_t *pTask ) { switch( pTask->iTask ) { case TASK_RAPPEL: { // If we don't do this, the beam won't show up sometimes. Ideally, all beams would update their // bboxes correctly, but we're close to shipping and we can't change that now. if ( m_hLine ) { m_hLine->RelinkBeam(); } if( GetEnemy() ) { // Face the enemy if there's one. Vector vecEnemyLKP = GetEnemyLKP(); GetOuter()->GetMotor()->SetIdealYawToTargetAndUpdate( vecEnemyLKP ); } SetDescentSpeed(); if( GetOuter()->GetFlags() & FL_ONGROUND ) { CBaseEntity *pGroundEnt = GetOuter()->GetGroundEntity(); if( pGroundEnt && pGroundEnt->IsPlayer() ) { // try to shove the player in the opposite direction as they are facing (so they'll see me) Vector vecForward; pGroundEnt->GetVectors( &vecForward, NULL, NULL ); pGroundEnt->SetAbsVelocity( vecForward * -500 ); break; } GetOuter()->m_OnRappelTouchdown.FireOutput( GetOuter(), GetOuter(), 0 ); GetOuter()->RemoveFlag( FL_FLY ); CutZipline(); TaskComplete(); } } break; default: BaseClass::RunTask( pTask ); break; } }
void CAI_RappelBehavior::CleanupOnDeath( CBaseEntity *pCulprit, bool bFireDeathOutput ) { BaseClass::CleanupOnDeath( pCulprit, bFireDeathOutput ); //This will remove the beam and create a rope if the NPC dies while rappeling down. if ( m_hLine ) { CAI_BaseNPC *pNPC = GetOuter(); if ( pNPC ) { CutZipline(); } } }
//----------------------------------------------------------------------------- // Purpose: // Input : *pTask - //----------------------------------------------------------------------------- void CAI_RappelBehavior::RunTask( const Task_t *pTask ) { switch( pTask->iTask ) { case TASK_RAPPEL: { // If we don't do this, the beam won't show up sometimes. Ideally, all beams would update their // bboxes correctly, but we're close to shipping and we can't change that now. if ( m_hLine ) { m_hLine->RelinkBeam(); } if( GetEnemy() ) { // Face the enemy if there's one. Vector vecEnemyLKP = GetEnemyLKP(); GetOuter()->GetMotor()->SetIdealYawToTargetAndUpdate( vecEnemyLKP ); } SetDescentSpeed(); if( GetOuter()->GetFlags() & FL_ONGROUND ) { GetOuter()->m_OnRappelTouchdown.FireOutput( GetOuter(), GetOuter(), 0 ); GetOuter()->RemoveFlag( FL_FLY ); CutZipline(); TaskComplete(); } } break; default: BaseClass::RunTask( pTask ); break; } }