//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- CBasePlayer *CMultiplayRules::GetDeathScorer( CBaseEntity *pKiller, CBaseEntity *pInflictor ) { if ( pKiller) { if ( pKiller->Classify() == CLASS_PLAYER ) return (CBasePlayer*)pKiller; // Killing entity might be specifying a scorer player IScorer *pScorerInterface = dynamic_cast<IScorer*>( pKiller ); if ( pScorerInterface ) { CBasePlayer *pPlayer = pScorerInterface->GetScorer(); if ( pPlayer ) return pPlayer; } // Inflicting entity might be specifying a scoring player pScorerInterface = dynamic_cast<IScorer*>( pInflictor ); if ( pScorerInterface ) { CBasePlayer *pPlayer = pScorerInterface->GetScorer(); if ( pPlayer ) return pPlayer; } } return NULL; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFBaseRocket::Explode( trace_t *pTrace, CBaseEntity *pOther ) { // Save this entity as enemy, they will take 100% damage. m_hEnemy = pOther; // Invisible. SetModelName( NULL_STRING ); AddSolidFlags( FSOLID_NOT_SOLID ); m_takedamage = DAMAGE_NO; // Pull out a bit. if ( pTrace->fraction != 1.0 ) { SetAbsOrigin( pTrace->endpos + ( pTrace->plane.normal * 1.0f ) ); } // Play explosion sound and effect. Vector vecOrigin = GetAbsOrigin(); CPVSFilter filter( vecOrigin ); TE_TFExplosion( filter, 0.0f, vecOrigin, pTrace->plane.normal, GetWeaponID(), pOther->entindex() ); CSoundEnt::InsertSound ( SOUND_COMBAT, vecOrigin, 1024, 3.0 ); // Damage. CBaseEntity *pAttacker = GetOwnerEntity(); IScorer *pScorerInterface = dynamic_cast<IScorer*>( pAttacker ); if ( pScorerInterface ) { pAttacker = pScorerInterface->GetScorer(); } CTakeDamageInfo info( this, pAttacker, vec3_origin, vecOrigin, GetDamage(), GetDamageType() ); float flRadius = GetRadius(); RadiusDamage( info, vecOrigin, flRadius, CLASS_NONE, NULL ); // Debug! if ( tf_rocket_show_radius.GetBool() ) { DrawRadius( flRadius ); } // Don't decal players with scorch. if ( !pOther->IsPlayer() ) { UTIL_DecalTrace( pTrace, "Scorch" ); } // Remove the rocket. UTIL_Remove( this ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFBaseRocket::Explode( trace_t *pTrace, CBaseEntity *pOther ) { // Save this entity as enemy, they will take 100% damage. m_hEnemy = pOther; // Invisible. SetModelName( NULL_STRING ); AddSolidFlags( FSOLID_NOT_SOLID ); m_takedamage = DAMAGE_NO; // Figure out Econ ID. int iItemID = -1; if ( m_hLauncher.Get() ) { CTFWeaponBase *pWeapon = dynamic_cast<CTFWeaponBase *>( m_hLauncher.Get() ); if ( pWeapon ) { iItemID = pWeapon->GetItemID(); } } // Pull out a bit. if ( pTrace->fraction != 1.0 ) { SetAbsOrigin( pTrace->endpos + ( pTrace->plane.normal * 1.0f ) ); } CBaseEntity *pAttacker = GetOwnerEntity(); IScorer *pScorerInterface = dynamic_cast<IScorer*>( pAttacker ); if ( pScorerInterface ) { pAttacker = pScorerInterface->GetScorer(); } // Play explosion sound and effect. Vector vecOrigin = GetAbsOrigin(); CPVSFilter filter( vecOrigin ); bool bCrit = ( GetDamageType() & DMG_CRITICAL ) != 0; TE_TFExplosion( filter, 0.0f, vecOrigin, pTrace->plane.normal, GetWeaponID(), pOther->entindex(), ToBasePlayer( pAttacker ), GetTeamNumber(), bCrit, iItemID ); CSoundEnt::InsertSound( SOUND_COMBAT, vecOrigin, 1024, 3.0 ); // Damage. float flRadius = GetRadius(); CTFRadiusDamageInfo radiusInfo; radiusInfo.info.Set( this, pAttacker, m_hLauncher, vec3_origin, vecOrigin, GetDamage(), GetDamageType() ); radiusInfo.m_vecSrc = vecOrigin; radiusInfo.m_flRadius = flRadius; radiusInfo.m_flSelfDamageRadius = 121.0f; // Original rocket radius? TFGameRules()->RadiusDamage( radiusInfo ); // Debug! if ( tf_rocket_show_radius.GetBool() ) { DrawRadius( flRadius ); } // Don't decal players with scorch. if ( !pOther->IsPlayer() ) { UTIL_DecalTrace( pTrace, "Scorch" ); } // Remove the rocket. UTIL_Remove( this ); }