void CASW_Flamer_Projectile::FlameHit( CBaseEntity *pOther, const Vector &vecHitPos, bool bOnlyHurtUnignited ) { if (!pOther) return; bool bHurt = true; if ( pOther->m_takedamage != DAMAGE_NO) { if ( pOther == m_pLastHitEnt ) return; if ( bOnlyHurtUnignited) { CBaseAnimating* pAnim = dynamic_cast<CBaseAnimating*>(pOther); if ( pAnim && pAnim->IsOnFire() ) { bHurt = false; } } if ( bHurt ) { Vector vecNormalizedVel = GetAbsVelocity(); ClearMultiDamage(); VectorNormalize( vecNormalizedVel ); if( GetOwnerEntity() && GetOwnerEntity()->IsPlayer() && pOther->IsNPC() ) { CTakeDamageInfo dmgInfo( this, m_pGetsCreditedForDamage, m_flDamage, DMG_BURN ); dmgInfo.AdjustPlayerDamageInflictedForSkillLevel(); CalculateMeleeDamageForce( &dmgInfo, vecNormalizedVel, vecHitPos, asw_flamer_force.GetFloat() ); dmgInfo.SetDamagePosition( vecHitPos ); dmgInfo.SetWeapon( m_hCreatorWeapon.Get() ); pOther->TakeDamage(dmgInfo); } else { CTakeDamageInfo dmgInfo( this, m_pGetsCreditedForDamage, m_flDamage, DMG_BURN ); CalculateMeleeDamageForce( &dmgInfo, vecNormalizedVel, vecHitPos, asw_flamer_force.GetFloat() ); dmgInfo.SetDamagePosition( vecHitPos ); dmgInfo.SetWeapon( m_hCreatorWeapon.Get() ); pOther->TakeDamage(dmgInfo); } ApplyMultiDamage(); // keep going through normal entities? m_pLastHitEnt = pOther; } if ( pOther->Classify() == CLASS_ASW_SHIELDBUG ) // We also want to bounce off shield bugs { Vector vel = GetAbsVelocity(); Vector dir = vel; VectorNormalize( dir ); // reflect velocity around normal vel = -2.0f * dir + vel; vel *= 0.4f; // absorb 80% in impact SetAbsVelocity( vel ); } return; } if ( pOther->GetCollisionGroup() == ASW_COLLISION_GROUP_PASSABLE ) return; trace_t tr; tr = BaseClass::GetTouchTrace(); // See if we struck the world if ( pOther->GetMoveType() == MOVETYPE_NONE && !( tr.surface.flags & SURF_SKY ) ) { Vector vel = GetAbsVelocity(); if ( tr.startsolid ) { if ( !m_inSolid ) { // UNDONE: Do a better contact solution that uses relative velocity? vel *= -1.0f; // bounce backwards SetAbsVelocity(vel); } m_inSolid = true; return; } m_inSolid = false; if ( tr.DidHit() ) { Vector dir = vel; VectorNormalize(dir); // reflect velocity around normal vel = -2.0f * tr.plane.normal * DotProduct(vel,tr.plane.normal) + vel; vel *= 0.4f; // absorb 80% in impact //vel *= GRENADE_COEFFICIENT_OF_RESTITUTION; SetAbsVelocity( vel ); } return; } else { // Put a mark unless we've hit the sky if ( ( tr.surface.flags & SURF_SKY ) == false ) { UTIL_ImpactTrace( &tr, DMG_BURN ); } KillEffects(); UTIL_Remove( this ); } }