From 4325a34acfff40be2e61ebec7748045d6bc682d6 Mon Sep 17 00:00:00 2001 From: Shtoyan Date: Fri, 21 Jan 2022 23:07:54 +0400 Subject: [PATCH] siren won't scream at low hp zeds, will melee --- sources/Zeds/Nice/NiceZombieSiren.uc | 72 +++++++++++++++++----------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/sources/Zeds/Nice/NiceZombieSiren.uc b/sources/Zeds/Nice/NiceZombieSiren.uc index 6a5c687..ad5b69b 100644 --- a/sources/Zeds/Nice/NiceZombieSiren.uc +++ b/sources/Zeds/Nice/NiceZombieSiren.uc @@ -77,48 +77,62 @@ function DiscardCurrentScreamBall(){ currScreamTiming = -1; } } + function RangedAttack(Actor A) { local int LastFireTime; local float Dist; - if ( bShotAnim ) - return; + + if (bShotAnim) + return; Dist = VSize(A.Location - Location); - if ( Physics == PHYS_Swimming ) + + if (Physics == PHYS_Swimming) { - SetAnimAction('Claw'); - bShotAnim = true; - LastFireTime = Level.TimeSeconds; + SetAnimAction('Claw'); + bShotAnim = true; + LastFireTime = Level.TimeSeconds; } - else if(Dist < MeleeRange + CollisionRadius + A.CollisionRadius && A != Self) + else if (Dist < MeleeRange + CollisionRadius + A.CollisionRadius && A != Self) { - bShotAnim = true; - LastFireTime = Level.TimeSeconds; - SetAnimAction('Claw'); - Controller.bPreparingMove = true; - Acceleration = vect(0,0,0); + bShotAnim = true; + LastFireTime = Level.TimeSeconds; + SetAnimAction('Claw'); + Controller.bPreparingMove = true; + Acceleration = vect(0,0,0); } - else if( Dist <= ScreamRadius && !bDecapitated && !bZapped ) + // ok se we DO NOT want to scream at other nice zeds + else if (!bNotAHuman() && Dist <= ScreamRadius && !bDecapitated && !bZapped) { - bShotAnim=true; - SetAnimAction('Siren_Scream'); - if(screamStartTime > 0) + bShotAnim = true; + SetAnimAction('Siren_Scream'); + if (screamStartTime > 0) DiscardCurrentScreamBall(); - currScreamTiming = 0; - screamStartTime = Level.TimeSeconds; - // Only stop moving if we are close - if( Dist < ScreamRadius * 0.25 ) - { - Controller.bPreparingMove = true; - Acceleration = vect(0,0,0); - } - else - { - Acceleration = AccelRate * Normal(A.Location - Location); - } - Acceleration.Z = FMin(Acceleration.Z, 0.0f); + currScreamTiming = 0; + screamStartTime = Level.TimeSeconds; + // Only stop moving if we are close + if (Dist < ScreamRadius * 0.25) + { + Controller.bPreparingMove = true; + Acceleration = vect(0,0,0); + } + else + { + Acceleration = AccelRate * Normal(A.Location - Location); + } + Acceleration.Z = FMin(Acceleration.Z, 0.0f); } } + +final private function bool bNotAHuman() +{ + if (Controller == none || Controller.Enemy == none) + return false; + + // log("Zed enemy classname was " $ Controller.Enemy.class); + return ClassIsChildOf(Controller.Enemy.class, class'NiceMonster'); +} + simulated function int DoAnimAction( name AnimName ) { if( AnimName=='Siren_Scream' || AnimName=='Siren_Bite' || AnimName=='Siren_Bite2' )