//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFGrenadePipebombProjectile::Detonate() { if ( ShouldNotDetonate() ) { RemoveGrenade(); return; } if ( m_bFizzle ) { g_pEffects->Sparks( GetAbsOrigin() ); RemoveGrenade(); return; } BaseClass::Detonate(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFGrenadeNailProjectile::Detonate() { if ( ShouldNotDetonate() ) { RemoveGrenade(); return; } StartEmittingNails(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFGrenadeMirvProjectile::Detonate() { if ( ShouldNotDetonate() ) { RemoveGrenade(); return; } BaseClass::Detonate(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFGrenadeEmpProjectile::Detonate() { if ( ShouldNotDetonate() ) { RemoveGrenade(); return; } // Explosion effect on client // SendDispatchEffect(); float flRadius = 180; float flDamage = 1; if ( tf_grenade_show_radius.GetBool() ) { DrawRadius( flRadius ); } // Apply some amount of EMP damage to every entity in the radius. They will calculate // their own damage based on how much ammo they have or some other wacky calculation. CTakeDamageInfo info( this, GetThrower(), vec3_origin, GetAbsOrigin(), flDamage, /* DMG_EMP |*/ DMG_PREVENT_PHYSICS_FORCE ); CBaseEntity *pEntityList[100]; int nEntityCount = UTIL_EntitiesInSphere( pEntityList, 100, GetAbsOrigin(), flRadius, 0 ); int iEntity; for ( iEntity = 0; iEntity < nEntityCount; ++iEntity ) { CBaseEntity *pEntity = pEntityList[iEntity]; if ( pEntity == this ) continue; if ( pEntity && pEntity->IsPlayer() ) continue; if ( pEntity && ( pEntity->m_takedamage == DAMAGE_YES || pEntity->m_takedamage == DAMAGE_EVENTS_ONLY ) ) { pEntity->TakeDamage( info ); //if ( pEntity->IsPlayer() /* || is ammo box || is enemy object */ ) { CBeam *pBeam = CBeam::BeamCreate( "sprites/physcannon_bluelight1b.vmt", 3.0 ); if ( !pBeam ) return; pBeam->PointsInit( GetAbsOrigin(), pEntity->WorldSpaceCenter() ); pBeam->SetColor( 255, 255, 255 ); pBeam->SetBrightness( 128 ); pBeam->SetNoise( 12.0f ); pBeam->SetEndWidth( 3.0f ); pBeam->SetWidth( 3.0f ); pBeam->LiveForTime( 0.5f ); // Fail-safe pBeam->SetFrameRate( 25.0f ); pBeam->SetFrame( random->RandomInt( 0, 2 ) ); } } } DispatchParticleEffect( "emp_shockwave", GetAbsOrigin(), vec3_angle ); UTIL_Remove( this ); #if 0 // Tell the bots an HE grenade has exploded CTFPlayer *pPlayer = ToTFPlayer( GetThrower() ); if ( pPlayer ) { KeyValues *pEvent = new KeyValues( "tf_weapon_grenade_detonate" ); pEvent->SetInt( "userid", pPlayer->GetUserID() ); gameeventmanager->FireEventServerOnly( pEvent ); } #endif }