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,17 +212,28 @@ 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)
|
||||
return;
|
||||
bHurtEntry = true;
|
||||
|
||||
InitMomentum = Momentum;
|
||||
if (screamStartTime > 0 && currScreamTiming == 0)
|
||||
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;
|
||||
// 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')){
|
||||
if ((Victims != self) && !Victims.IsA('FluidSurfaceInfo') && !Victims.IsA('KFMonster') && !Victims.IsA('ExtendedZCollision'))
|
||||
{
|
||||
dir = Victims.Location - HitLocation;
|
||||
dist = FMax(1,VSize(dir));
|
||||
dir = dir/dist;
|
||||
@ -229,7 +241,8 @@ simulated function HurtRadius(float DamageAmount, float DamageRadius, class<Dama
|
||||
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
|
||||
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;
|
||||
@ -246,8 +259,10 @@ simulated function HurtRadius(float DamageAmount, float DamageRadius, class<Dama
|
||||
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