I haven't tested it, expecting some feedback first to make proper modifications.
Code: Select all
function XC_HurtRadius( float DamageAmount, float DamageRadius, name DamageName, float Momentum, vector HitLocation, optional actor HitActor , optional float ExtraSeek)
{
local actor Victims, aTrace;
local float damageScale, dist;
local vector dir, HLoc, HNorm;
if( bHurtEntry )
return;
//Hitactor takes full damage, it's a forced hit
if ( HitActor != none )
{
HNorm = Normal(HitActor.Location - HitLocation);
HitActor.TakeDamage( DamageAmount, Instigator, HitActor.Location - HNorm * 0.5 * (HitActor.CollisionHeight + HitActor.CollisionRadius), HNorm * Momentum, DamageName);
HitActor.bHurtEntry = true;
}
bHurtEntry = true;
foreach VisibleCollidingActors( class 'Actor', Victims, DamageRadius + ExtraSeek, HitLocation )
{
if ( !Victims.bHurtEntry )
{
DamageScale = 1;
aTrace = none;
ForEach TraceActors( class'Actor', aTrace, HLoc, HNorm, Victims.Location, HitLocation)
{
if ( aTrace == Victims )
{
damageScale *= 1 - VSize(HLoc - HitLocation) / DamageRadius;
if ( damageScale > 0 )
Victims.TakeDamage( damageScale * DamageAmount, Instigator, HLoc, (Momentum * damageScale * HNorm), DamageName);
break;
}
if ( (aTrace == Level) || (Mover(aTrace) != none) )
break;
//Apply damage reduction if blocked by actor, adjustable here
if ( aTrace.bBlockActors )
DamageScale *= 0.7;
}
}
}
bHurtEntry = false;
if ( HitActor != none )
HitActor.bHurtEntry = false;
}
- Direct impact damage for special explosions, usage is optional.
Ensures this actor receives full damage, to use when a colliding actor is placed outside of map geometry.
Would solve some issues with misplaced FortStandards, and other pawns/decorations placed outside of the map.
- ExtraSeek parameter allows seeking for greater distances, this prevents some low radius projectiles from failing to damage big Pawns.
A common issue is trying to damage a titan with the ASMD or Shock Rifle alt, an ExtraSeek value of 30 or 40 will solve it.
- HitLocation and Momentum vectors are precise, contributes to better hit information.
Some other mutators or actors might find the benefits of this.
- Damage and Momentum correctly scaled due to precision.
HurtRadius doesn't deal full damage if you hit a player's feet or head.
- Movers properly block the traces, even on NM_DedicatedServer mode.
Otherwise, you can kill enemies through doors and lifts on servers.
- Adjustable body shielding damage reduction, now hiding behind a decoration or another player will have positive consequences.
I know a couple of gametypes that could find this very useful...
Opinions?