nicezombiesiren iterator optimization
This commit is contained in:
parent
f2b65b61ad
commit
f5634b2025
@ -202,6 +202,7 @@ simulated function DoShakeEffect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
simulated function HurtRadius(float DamageAmount, float DamageRadius, class<DamageType> DamageType, float Momentum, vector HitLocation)
|
||||
{
|
||||
local actor Victims;
|
||||
@ -211,43 +212,57 @@ simulated function HurtRadius(float DamageAmount, float DamageRadius, class<Dama
|
||||
local float UsedDamageAmount;
|
||||
local KFHumanPawn humanPawn;
|
||||
local class<NiceVeterancyTypes> niceVet;
|
||||
if(bHurtEntry || Health <= 0 || HeadHealth <= 0 || bIsStunned)
|
||||
|
||||
if (bHurtEntry || Health <= 0 || HeadHealth <= 0 || bIsStunned)
|
||||
return;
|
||||
bHurtEntry = true;
|
||||
|
||||
InitMomentum = Momentum;
|
||||
if(screamStartTime > 0 && currScreamTiming == 0)
|
||||
if (screamStartTime > 0 && currScreamTiming == 0)
|
||||
MakeNewScreamBall();
|
||||
foreach VisibleCollidingActors(class 'Actor', Victims, DamageRadius, HitLocation){
|
||||
Momentum = InitMomentum;
|
||||
// don't let blast damage affect fluid - VisibleCollisingActors doesn't really work for them - jag
|
||||
// Or Karma actors in this case. Self inflicted Death due to flying chairs is uncool for a zombie of your stature.
|
||||
if((Victims != self) && !Victims.IsA('FluidSurfaceInfo') && !Victims.IsA('KFMonster') && !Victims.IsA('ExtendedZCollision')){
|
||||
dir = Victims.Location - HitLocation;
|
||||
dist = FMax(1,VSize(dir));
|
||||
dir = dir/dist;
|
||||
damageScale = 1 - FMax(0,(dist - Victims.CollisionRadius)/DamageRadius);
|
||||
humanPawn = KFHumanPawn(Victims);
|
||||
if(humanPawn == none) // If it aint human, don't pull the vortex crap on it.
|
||||
Momentum = 0;
|
||||
else{ // Also don't do it if we're sharpshooter with a right skill
|
||||
niceVet = class'NiceVeterancyTypes'.static.GetVeterancy(humanPawn.PlayerReplicationInfo);
|
||||
if(niceVet != none && !niceVet.static.CanBePulled(KFPlayerReplicationInfo(humanPawn.PlayerReplicationInfo)))
|
||||
Momentum = 0;
|
||||
}
|
||||
|
||||
if(Victims.IsA('KFGlassMover')) // Hack for shattering in interesting ways.
|
||||
UsedDamageAmount = 100000; // Siren always shatters glass
|
||||
else
|
||||
UsedDamageAmount = DamageAmount;
|
||||
// was VisibleCollidingActors
|
||||
foreach CollidingActors(class'Actor', Victims, DamageRadius, HitLocation)
|
||||
{
|
||||
// some optimizations
|
||||
// https://wiki.beyondunreal.com/Legacy:Code_Optimization#Optimize_iterator_use
|
||||
if (Victims.bStatic || Victims.Physics == PHYS_None || !FastTrace(Victims.Location, Location) )
|
||||
continue; // skip this actor
|
||||
|
||||
Victims.TakeDamage(damageScale * UsedDamageAmount,Instigator, Victims.Location - 0.5 * (Victims.CollisionHeight + Victims.CollisionRadius) * dir, (damageScale * Momentum * dir), DamageType);
|
||||
Momentum = InitMomentum;
|
||||
// don't let blast damage affect fluid - VisibleCollisingActors doesn't really work for them - jag
|
||||
// Or Karma actors in this case. Self inflicted Death due to flying chairs is uncool for a zombie of your stature.
|
||||
if ((Victims != self) && !Victims.IsA('FluidSurfaceInfo') && !Victims.IsA('KFMonster') && !Victims.IsA('ExtendedZCollision'))
|
||||
{
|
||||
dir = Victims.Location - HitLocation;
|
||||
dist = FMax(1,VSize(dir));
|
||||
dir = dir/dist;
|
||||
damageScale = 1 - FMax(0,(dist - Victims.CollisionRadius)/DamageRadius);
|
||||
humanPawn = KFHumanPawn(Victims);
|
||||
if (humanPawn == none) // If it aint human, don't pull the vortex crap on it.
|
||||
Momentum = 0;
|
||||
else
|
||||
{ // Also don't do it if we're sharpshooter with a right skill
|
||||
niceVet = class'NiceVeterancyTypes'.static.GetVeterancy(humanPawn.PlayerReplicationInfo);
|
||||
if (niceVet != none && !niceVet.static.CanBePulled(KFPlayerReplicationInfo(humanPawn.PlayerReplicationInfo)))
|
||||
Momentum = 0;
|
||||
}
|
||||
|
||||
if (Instigator != none && Vehicle(Victims) != none && Vehicle(Victims).Health > 0)
|
||||
Vehicle(Victims).DriverRadiusDamage(UsedDamageAmount, DamageRadius, Instigator.Controller, DamageType, Momentum, HitLocation);
|
||||
}
|
||||
if (Victims.IsA('KFGlassMover')) // Hack for shattering in interesting ways.
|
||||
UsedDamageAmount = 100000; // Siren always shatters glass
|
||||
else
|
||||
UsedDamageAmount = DamageAmount;
|
||||
|
||||
Victims.TakeDamage(damageScale * UsedDamageAmount,Instigator, Victims.Location - 0.5 * (Victims.CollisionHeight + Victims.CollisionRadius) * dir, (damageScale * Momentum * dir), DamageType);
|
||||
|
||||
if (Instigator != none && Vehicle(Victims) != none && Vehicle(Victims).Health > 0)
|
||||
Vehicle(Victims).DriverRadiusDamage(UsedDamageAmount, DamageRadius, Instigator.Controller, DamageType, Momentum, HitLocation);
|
||||
}
|
||||
}
|
||||
|
||||
bHurtEntry = false;
|
||||
}
|
||||
|
||||
// When siren loses her head she's got nothin' Kill her.
|
||||
function RemoveHead(){
|
||||
Super.RemoveHead();
|
||||
|
Loading…
Reference in New Issue
Block a user