void CBaseHelicopter::Event_Killed( const CTakeDamageInfo &info ) { m_lifeState = LIFE_DYING; SetMoveType( MOVETYPE_FLYGRAVITY ); SetGravity( UTIL_ScaleForGravity( 240 ) ); // use a lower gravity StopLoopingSounds(); UTIL_SetSize( this, Vector( -32, -32, -64), Vector( 32, 32, 0) ); SetThink( &CBaseHelicopter::CallDyingThink ); SetTouch( &CBaseHelicopter::CrashTouch ); SetNextThink( gpGlobals->curtime + 0.1f ); m_iHealth = 0; m_takedamage = DAMAGE_NO; /* if (m_spawnflags & SF_NOWRECKAGE) { m_flNextRocket = gpGlobals->curtime + 4.0; } else { m_flNextRocket = gpGlobals->curtime + 15.0; } */ StopRotorWash(); m_OnDeath.FireOutput( info.GetAttacker(), this ); }
//----------------------------------------------------------------------------- // Purpose: This is a generic function (to be implemented by sub-classes) to // handle specific interactions between different types of characters // (For example the barnacle grabbing an NPC) // Input : Constant for the type of interaction // Output : true - if sub-class has a response for the interaction // false - if sub-class has no response //----------------------------------------------------------------------------- bool CNPC_Crow::HandleInteraction( int interactionType, void *data, CBaseCombatCharacter *sourceEnt ) { if ( interactionType == g_interactionBarnacleVictimDangle ) { // Die instantly return false; } else if ( interactionType == g_interactionBarnacleVictimGrab ) { if ( GetFlags() & FL_ONGROUND ) { SetGroundEntity( NULL ); } // return ideal grab position if (data) { // FIXME: need a good way to ensure this contract *((Vector *)data) = GetAbsOrigin() + Vector( 0, 0, 5 ); } StopLoopingSounds(); SetThink( NULL ); return true; } return BaseClass::HandleInteraction( interactionType, data, sourceEnt ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTeamControlPoint::CaptureInterrupted( bool bBlocked ) { StopLoopingSounds(); if ( FBitSet( m_spawnflags, SF_CAP_POINT_NO_CAP_SOUNDS ) ) { return; } const char *pSoundName = NULL; if ( bBlocked == true ) { pSoundName = STRING( m_iszCaptureInterrupted ); } else { pSoundName = STRING( m_iszCaptureInProgress ); EmitSound( STRING( m_iszCaptureStartSound ) ); } if ( m_pCaptureInProgressSound == NULL && pSoundName != NULL ) { CPASFilter filter( GetAbsOrigin() ); CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController(); m_pCaptureInProgressSound = controller.SoundCreate( filter, entindex(), pSoundName ); controller.Play( m_pCaptureInProgressSound, 1.0, 100 ); } }
//----------------------------------------------------------------------------- // Super-powers the entities //----------------------------------------------------------------------------- void CTriggerSuperArmor::RechargeThink() { Assert( m_hTouchingEntities.Count() == 1 ); for ( int i = m_hTouchingEntities.Count(); --i >= 0; ) { CBasePlayer *pPlayer = assert_cast<CBasePlayer*>( m_hTouchingEntities[i].Get() ); if (( pPlayer->ArmorValue() < MAX_SUPER_ARMOR ) || ( pPlayer->GetHealth() < 100 )) { pPlayer->TakeHealth( 5, DMG_GENERIC ); pPlayer->IncrementArmorValue( 15, MAX_SUPER_ARMOR ); if ( pPlayer->ArmorValue() >= MAX_SUPER_ARMOR ) { pPlayer->EmitSound( "TriggerSuperArmor.DoneCharging" ); StopLoopingSounds(); } else { if ( m_flLoopingSoundTime < gpGlobals->curtime ) { StartLoopingSounds( m_hTouchingEntities[i] ); } } } } SetContextThink( &CTriggerSuperArmor::RechargeThink, gpGlobals->curtime + 0.1f, s_pRechargeThinkContext ); }
void QUA_helicopter::Event_Killed( const CTakeDamageInfo &info ) { //m_lifeState=LIFE_DYING; // Calculate death force m_vecTotalBulletForce = CalcDamageForceVector( info ); CBasePlayer *pPlayer = m_hPlayer; if ( pPlayer ) { pPlayer->LeaveVehicle(); // Force exit vehicle CBaseEntity *pAPC=this->GetBaseEntity(); CTakeDamageInfo playerinfo; if (info.GetAttacker()==pAPC && info.GetInflictor()==pAPC) { playerinfo.SetAttacker(pPlayer); playerinfo.SetInflictor(pPlayer); playerinfo.SetDamage(10000); playerinfo.SetDamageType(DMG_BLAST); } else { playerinfo.SetAttacker(info.GetAttacker()); playerinfo.SetInflictor(info.GetInflictor()); playerinfo.SetDamage(10000); playerinfo.SetDamageType(DMG_BLAST); } playerinfo.SetDamagePosition( pPlayer->WorldSpaceCenter() ); playerinfo.SetDamageForce( Vector(0,0,-1) ); pPlayer->TakeDamage( playerinfo ); m_hPlayer = NULL; } m_OnDeath.FireOutput( info.GetAttacker(), this ); //StopSmoking(); Vector vecAbsMins, vecAbsMaxs; CollisionProp()->WorldSpaceAABB( &vecAbsMins, &vecAbsMaxs ); Vector vecNormalizedMins, vecNormalizedMaxs; CollisionProp()->WorldToNormalizedSpace( vecAbsMins, &vecNormalizedMins ); CollisionProp()->WorldToNormalizedSpace( vecAbsMaxs, &vecNormalizedMaxs ); Vector vecAbsPoint; CPASFilter filter( GetAbsOrigin() ); for (int i = 0; i < 5; i++) { CollisionProp()->RandomPointInBounds( vecNormalizedMins, vecNormalizedMaxs, &vecAbsPoint ); te->Explosion( filter, random->RandomFloat( 0.0, 1.0 ), &vecAbsPoint, g_sModelIndexFireball, random->RandomInt( 4, 10 ), random->RandomInt( 8, 15 ), ( i < 2 ) ? TE_EXPLFLAG_NODLIGHTS : TE_EXPLFLAG_NOPARTICLES | TE_EXPLFLAG_NOFIREBALLSMOKE | TE_EXPLFLAG_NODLIGHTS, 100, 0 ); } // Aqui destruiremos todo StopLoopingSounds(); BecomeRagdoll( info, m_vecTotalBulletForce ); UTIL_ScreenShake( vecAbsPoint, 25.0, 150.0, 1.0, 750.0f, SHAKE_START ); CreateCorpse(); //BecomeRagdoll( info, m_vecTotalBulletForce ); //BecomeRagdollOnClient(m_vecTotalBulletForce); //Dissolve(NULL, gpGlobals->curtime, false, ENTITY_DISSOLVE_NORMAL); }
CASW_Parasite::~CASW_Parasite() { StopLoopingSounds(); if (GetEgg()) { GetEgg()->ParasiteDied(this); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTeamControlPoint::CaptureEnd( void ) { StopLoopingSounds(); if ( !FBitSet( m_spawnflags, SF_CAP_POINT_NO_CAP_SOUNDS ) ) { EmitSound( STRING( m_iszCaptureEndSound ) ); } }
//----------------------------------------------------------------------------- // Ends super-powerings the entities //----------------------------------------------------------------------------- void CTriggerSuperArmor::EndTouch( CBaseEntity *pOther ) { BaseClass::EndTouch( pOther ); if ( !pOther->IsPlayer() ) return; if ( m_hTouchingEntities.Count() == 0 ) { StopLoopingSounds(); SetContextThink( NULL, gpGlobals->curtime + 0.01f, s_pRechargeThinkContext ); } }
// we're done clawing our way in, remove the AI void CASW_Parasite::FinishedInfesting() { StopLoopingSounds(); // notify everything that needs to know about our death if (ASWGameRules()) { CTakeDamageInfo info; ASWGameRules()->AlienKilled(this, info); } if (m_hSpawner.Get()) m_hSpawner->AlienKilled(this); if (GetMother()) GetMother()->ChildAlienKilled(this); UTIL_Remove( this ); SetThink( NULL ); //We're going away, so don't think anymore. SetTouch( NULL ); }
void CRocket_Turret_Projectile::DoExplosion( void ) { NotifyLauncherOnDeath(); StopLoopingSounds(); // Explode ExplosionCreate( GetAbsOrigin(), GetAbsAngles(), GetOwnerEntity(), 200, 25, SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSMOKE, 100.0f, this); // Hackish: Knock turrets in the area CBaseEntity* pTurretIter = NULL; while ( (pTurretIter = gEntList.FindEntityByClassnameWithin( pTurretIter, "npc_portal_turret_floor", GetAbsOrigin(), 128 )) != NULL ) { CTakeDamageInfo info( this, this, 200, DMG_BLAST ); info.SetDamagePosition( GetAbsOrigin() ); CalculateExplosiveDamageForce( &info, (pTurretIter->GetAbsOrigin() - GetAbsOrigin()), GetAbsOrigin() ); pTurretIter->VPhysicsTakeDamage( info ); } }
void CASW_Simple_Alien::Event_Killed( const CTakeDamageInfo &info ) { if (ASWGameRules()) { ASWGameRules()->AlienKilled(this, info); } if (m_hSpawner.Get()) m_hSpawner->AlienKilled(this); // Calculate death force Vector forceVector = CalcDeathForceVector( info ); StopLoopingSounds(); DeathSound(info); // todo: remove touch function? SetState(ASW_SIMPLE_ALIEN_DEAD); // todo: Select a death pose to extrapolate the ragdoll's velocity? //SelectDeathPose( info ); if (!ShouldGib(info)) { SetCollisionGroup(ASW_COLLISION_GROUP_PASSABLE); // don't block marines by dead bodies if ( BecomeRagdollOnClient( forceVector ) ) { } } else { Event_Gibbed( info ); } }