husk annoyance fixes

This commit is contained in:
Shtoyan 2022-01-19 16:30:47 +04:00
parent 4f708c52e0
commit f2b65b61ad

View File

@ -125,18 +125,28 @@ function float GetStunDurationMult(Pawn instigatedBy, Vector hitLocation, Vector
return 0.5 * stunDurationMultiplier;
}
function SpawnTwoShots(){
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);
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);
foreach DynamicActors(class'KFMonsterController', KFMonstControl)
if(KFMonstControl != controller && PointDistToLine(KFMonstControl.Pawn.Location, vector(FireRotation), FireStart) < 75)
{
// 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);
Spawn(HuskFireProjClass,,, FireStart, FireRotation);
}
// 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)
{