From d14b2290c326191386ff34faf935714c6c02cc2f Mon Sep 17 00:00:00 2001 From: Shtoyan Date: Sun, 23 Jan 2022 00:29:31 +0400 Subject: [PATCH] removed duplicate code in crawler classes --- sources/Zeds/Nice/NiceZombieCrawler.uc | 1 + sources/Zeds/Nice/NiceZombieCrawlerBase.uc | 98 +--------------------- 2 files changed, 3 insertions(+), 96 deletions(-) diff --git a/sources/Zeds/Nice/NiceZombieCrawler.uc b/sources/Zeds/Nice/NiceZombieCrawler.uc index f70ad70..a4ce6cf 100644 --- a/sources/Zeds/Nice/NiceZombieCrawler.uc +++ b/sources/Zeds/Nice/NiceZombieCrawler.uc @@ -69,6 +69,7 @@ simulated function int DoAnimAction( name AnimName ) } return Super.DoAnimAction(AnimName); } + simulated event SetAnimAction(name NewAction) { local int meleeAnimIndex; diff --git a/sources/Zeds/Nice/NiceZombieCrawlerBase.uc b/sources/Zeds/Nice/NiceZombieCrawlerBase.uc index f21f995..87eb48b 100644 --- a/sources/Zeds/Nice/NiceZombieCrawlerBase.uc +++ b/sources/Zeds/Nice/NiceZombieCrawlerBase.uc @@ -1,7 +1,7 @@ // Zombie Monster for KF Invasion gametype class NiceZombieCrawlerBase extends NiceMonster abstract; -#exec OBJ LOAD FILE= +// #exec OBJ LOAD FILE= var() float PounceSpeed; var bool bPouncing; var(Anims) name MeleeAirAnims[3]; // Attack anims for when flying through the air @@ -9,101 +9,7 @@ var(Anims) name MeleeAirAnims[3]; // Attack anims for when flying through th // NOTE: All Code resides in the child class(this class was only created to // eliminate hitching caused by loading default properties during play) //------------------------------------------------------------------------------- -function bool DoPounce() -{ - if ( bZapped || bIsCrouched || bWantsToCrouch || (Physics != PHYS_Walking) || VSize(Location - Controller.Target.Location) > (MeleeRange * 5) ) - return false; - Velocity = Normal(Controller.Target.Location-Location)*PounceSpeed; - Velocity.Z = JumpZ; - SetPhysics(PHYS_Falling); - ZombieSpringAnim(); - bPouncing=true; - return true; -} -simulated function ZombieSpringAnim() -{ - SetAnimAction('ZombieSpring'); -} -event Landed(vector HitNormal) -{ - bPouncing=false; - super.Landed(HitNormal); -} -event Bump(actor Other) -{ - // TODO: is there a better way - if(bPouncing && KFHumanPawn(Other)!=none ) - { - KFHumanPawn(Other).TakeDamage(((MeleeDamage - (MeleeDamage * 0.05)) + (MeleeDamage * (FRand() * 0.1))), self ,self.Location,self.velocity, class'NiceZedMeleeDamageType'); - if (KFHumanPawn(Other).Health <=0) - { - //TODO - move this to humanpawn.takedamage? Also see KFMonster.MeleeDamageTarget - KFHumanPawn(Other).SpawnGibs(self.rotation, 1); - } - //After impact, there'll be no momentum for further bumps - bPouncing=false; - } -} -// Blend his attacks so he can hit you in mid air. -simulated function int DoAnimAction( name AnimName ) -{ - if( AnimName=='InAir_Attack1' || AnimName=='InAir_Attack2' ) - { - AnimBlendParams(1, 1.0, 0.0,, FireRootBone); - PlayAnim(AnimName,, 0.0, 1); - return 1; - } - if( AnimName=='HitF' ) - { - AnimBlendParams(1, 1.0, 0.0,, NeckBone); - PlayAnim(AnimName,, 0.0, 1); - return 1; - } - if( AnimName=='ZombieSpring' ) - { - PlayAnim(AnimName,,0.02); - return 0; - } - return Super.DoAnimAction(AnimName); -} -simulated event SetAnimAction(name NewAction) -{ - local int meleeAnimIndex; - if( NewAction=='' ) - Return; - if(NewAction == 'Claw') - { - meleeAnimIndex = Rand(2); - if( Physics == PHYS_Falling ) - { - NewAction = MeleeAirAnims[meleeAnimIndex]; - } - else - { - NewAction = meleeAnims[meleeAnimIndex]; - } - } - ExpectingChannel = DoAnimAction(NewAction); - if( AnimNeedsWait(NewAction) ) - { - bWaitForAnim = true; - } - if( Level.NetMode!=NM_Client ) - { - AnimAction = NewAction; - bResetAnimAct = True; - ResetAnimActTime = Level.TimeSeconds+0.3; - } -} -// The animation is full body and should set the bWaitForAnim flag -simulated function bool AnimNeedsWait(name TestAnim) -{ - if( TestAnim == 'ZombieSpring' || TestAnim == 'DoorBash' ) - { - return true; - } - return false; -} + defaultproperties { PounceSpeed=330.000000