diff --git a/sources/Zeds/Nice/NiceZombieHusk.uc b/sources/Zeds/Nice/NiceZombieHusk.uc index 88cb718..aa95471 100644 --- a/sources/Zeds/Nice/NiceZombieHusk.uc +++ b/sources/Zeds/Nice/NiceZombieHusk.uc @@ -125,18 +125,28 @@ function float GetStunDurationMult(Pawn instigatedBy, Vector hitLocation, Vector return 0.5 * stunDurationMultiplier; } -function SpawnTwoShots(){ - local vector X,Y,Z, FireStart; +function SpawnTwoShots() +{ + local vector X, Y, Z, FireStart; local rotator FireRotation; local KFMonsterController KFMonstControl; - if(controller != none && KFDoorMover(controller.Target) != none){ - controller.Target.TakeDamage(22,Self,Location,vect(0,0,0),Class'DamTypeVomit'); + + // can NOT shoot if brainless, dying, falling, being moved by other husks + if (Controller == none || IsInState('ZombieDying') || IsInState('GettingOutOfTheWayOfShot') || Physics == PHYS_Falling) + return; + + if (KFDoorMover(controller.Target) != none) + { + controller.Target.TakeDamage(22, Self, Location, vect(0, 0, 0), class'DamTypeVomit'); return; } - GetAxes(Rotation,X,Y,Z); + + GetAxes(Rotation, X, Y, Z); FireStart = GetBoneCoords('Barrel').Origin; - if(!SavedFireProperties.bInitialized){ - SavedFireProperties.AmmoClass = Class'SkaarjAmmo'; + + if (!SavedFireProperties.bInitialized) + { + SavedFireProperties.AmmoClass = class'SkaarjAmmo'; SavedFireProperties.ProjectileClass = HuskFireProjClass; SavedFireProperties.WarnTargetPct = 1; SavedFireProperties.MaxRange = 65535; @@ -146,17 +156,29 @@ function SpawnTwoShots(){ SavedFireProperties.bInstantHit = false; SavedFireProperties.bInitialized = true; } + // Turn off extra collision before spawning vomit, otherwise spawn fails ToggleAuxCollision(false); - if(controller != none) - FireRotation = controller.AdjustAim(SavedFireProperties,FireStart,600); + + FireRotation = controller.AdjustAim(SavedFireProperties, FireStart, 600); + foreach DynamicActors(class'KFMonsterController', KFMonstControl) - if(KFMonstControl != controller && PointDistToLine(KFMonstControl.Pawn.Location, vector(FireRotation), FireStart) < 75) - KFMonstControl.GetOutOfTheWayOfShot(vector(FireRotation),FireStart); - Spawn(HuskFireProjClass,,, FireStart, FireRotation); + { + // ignore zeds that the husk can't see, Joabyy + if (KFMonstControl == none || KFMonstControl == controller || !LineOfSightTo(KFMonstControl)) + continue; + + if (PointDistToLine(KFMonstControl.Pawn.Location, vector(FireRotation), FireStart) < 75) + KFMonstControl.GetOutOfTheWayOfShot(vector(FireRotation), FireStart); + } + + // added projectile owner... + Spawn(HuskFireProjClass, self, , FireStart, FireRotation); + // Turn extra collision back on ToggleAuxCollision(true); } + // Get the closest point along a line to another point simulated function float PointDistToLine(vector Point, vector Line, vector Origin, optional out vector OutClosestPoint) {