//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CGrenadeRocket::MissileTouch( CBaseEntity *pOther ) { Assert( pOther ); if ( !pOther->IsSolid() ) return; Vector vecAbsOrigin = GetAbsOrigin(); CPASFilter filter( vecAbsOrigin ); te->Explosion( filter, 0.0, &vecAbsOrigin, g_sModelIndexFireball, 2.0, 15, TE_EXPLFLAG_NONE, 100, m_flDamage ); StopSound( "GrenadeRocket.FlyLoop" ); // Don't apply explosive damage if it hit a shield of any kind... bool bHittingShield = false; if (pOther->GetCollisionGroup() == TFCOLLISION_GROUP_SHIELD) { bHittingShield = true; } else if ( pOther->IsPlayer() ) { CBaseTFPlayer *pPlayer = static_cast<CBaseTFPlayer*>(pOther); trace_t tr; float flDamage = m_flDamage; bHittingShield = pPlayer->IsHittingShield( GetAbsVelocity(), &flDamage ); } if (!bHittingShield) { RadiusDamage( CTakeDamageInfo( this, m_pRealOwner, m_flDamage, DMG_BLAST ), vecAbsOrigin, 100, CLASS_NONE ); } UTIL_Remove( this ); }
//----------------------------------------------------------------------------- // Purpose: // Input : *pOther - // tr - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CBasePlasmaProjectile::ProjectileHitShield( CBaseEntity *pOther, trace_t& tr ) { if ( !pOther ) return false; if ( !pOther->IsPlayer() ) return false; #if !defined( CLIENT_DLL ) CBaseTFPlayer* pPlayer = static_cast<CBaseTFPlayer*>(pOther); float flDamage = GetDamage(); if ( !pPlayer->IsHittingShield( GetAbsVelocity(), &flDamage ) ) return false; #else return false; #endif return true; }