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)
|
simulated function HurtRadius(float DamageAmount, float DamageRadius, class<DamageType> DamageType, float Momentum, vector HitLocation)
|
||||||
{
|
{
|
||||||
local actor Victims;
|
local actor Victims;
|
||||||
@ -211,31 +212,43 @@ simulated function HurtRadius(float DamageAmount, float DamageRadius, class<Dama
|
|||||||
local float UsedDamageAmount;
|
local float UsedDamageAmount;
|
||||||
local KFHumanPawn humanPawn;
|
local KFHumanPawn humanPawn;
|
||||||
local class<NiceVeterancyTypes> niceVet;
|
local class<NiceVeterancyTypes> niceVet;
|
||||||
if(bHurtEntry || Health <= 0 || HeadHealth <= 0 || bIsStunned)
|
|
||||||
|
if (bHurtEntry || Health <= 0 || HeadHealth <= 0 || bIsStunned)
|
||||||
return;
|
return;
|
||||||
bHurtEntry = true;
|
bHurtEntry = true;
|
||||||
|
|
||||||
InitMomentum = Momentum;
|
InitMomentum = Momentum;
|
||||||
if(screamStartTime > 0 && currScreamTiming == 0)
|
if (screamStartTime > 0 && currScreamTiming == 0)
|
||||||
MakeNewScreamBall();
|
MakeNewScreamBall();
|
||||||
foreach VisibleCollidingActors(class 'Actor', Victims, DamageRadius, HitLocation){
|
|
||||||
|
// 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
|
||||||
|
|
||||||
Momentum = InitMomentum;
|
Momentum = InitMomentum;
|
||||||
// don't let blast damage affect fluid - VisibleCollisingActors doesn't really work for them - jag
|
// 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.
|
// 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')){
|
if ((Victims != self) && !Victims.IsA('FluidSurfaceInfo') && !Victims.IsA('KFMonster') && !Victims.IsA('ExtendedZCollision'))
|
||||||
|
{
|
||||||
dir = Victims.Location - HitLocation;
|
dir = Victims.Location - HitLocation;
|
||||||
dist = FMax(1,VSize(dir));
|
dist = FMax(1,VSize(dir));
|
||||||
dir = dir/dist;
|
dir = dir/dist;
|
||||||
damageScale = 1 - FMax(0,(dist - Victims.CollisionRadius)/DamageRadius);
|
damageScale = 1 - FMax(0,(dist - Victims.CollisionRadius)/DamageRadius);
|
||||||
humanPawn = KFHumanPawn(Victims);
|
humanPawn = KFHumanPawn(Victims);
|
||||||
if(humanPawn == none) // If it aint human, don't pull the vortex crap on it.
|
if (humanPawn == none) // If it aint human, don't pull the vortex crap on it.
|
||||||
Momentum = 0;
|
Momentum = 0;
|
||||||
else{ // Also don't do it if we're sharpshooter with a right skill
|
else
|
||||||
|
{ // Also don't do it if we're sharpshooter with a right skill
|
||||||
niceVet = class'NiceVeterancyTypes'.static.GetVeterancy(humanPawn.PlayerReplicationInfo);
|
niceVet = class'NiceVeterancyTypes'.static.GetVeterancy(humanPawn.PlayerReplicationInfo);
|
||||||
if(niceVet != none && !niceVet.static.CanBePulled(KFPlayerReplicationInfo(humanPawn.PlayerReplicationInfo)))
|
if (niceVet != none && !niceVet.static.CanBePulled(KFPlayerReplicationInfo(humanPawn.PlayerReplicationInfo)))
|
||||||
Momentum = 0;
|
Momentum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Victims.IsA('KFGlassMover')) // Hack for shattering in interesting ways.
|
if (Victims.IsA('KFGlassMover')) // Hack for shattering in interesting ways.
|
||||||
UsedDamageAmount = 100000; // Siren always shatters glass
|
UsedDamageAmount = 100000; // Siren always shatters glass
|
||||||
else
|
else
|
||||||
UsedDamageAmount = DamageAmount;
|
UsedDamageAmount = DamageAmount;
|
||||||
@ -246,8 +259,10 @@ simulated function HurtRadius(float DamageAmount, float DamageRadius, class<Dama
|
|||||||
Vehicle(Victims).DriverRadiusDamage(UsedDamageAmount, DamageRadius, Instigator.Controller, DamageType, Momentum, HitLocation);
|
Vehicle(Victims).DriverRadiusDamage(UsedDamageAmount, DamageRadius, Instigator.Controller, DamageType, Momentum, HitLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bHurtEntry = false;
|
bHurtEntry = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When siren loses her head she's got nothin' Kill her.
|
// When siren loses her head she's got nothin' Kill her.
|
||||||
function RemoveHead(){
|
function RemoveHead(){
|
||||||
Super.RemoveHead();
|
Super.RemoveHead();
|
||||||
|
Loading…
Reference in New Issue
Block a user