Optimize code flow
This commit is contained in:
parent
2f3385583c
commit
3b5f46c2b5
@ -332,22 +332,15 @@ function Actor GetMainActor(Actor other) {
|
||||
return none;
|
||||
}
|
||||
|
||||
// Try owner
|
||||
if (
|
||||
KFPawn(other) == none &&
|
||||
KFMonster(other) == none &&
|
||||
(KFPawn(other.owner) != none || KFMonster(other.owner) != none)
|
||||
) {
|
||||
other = other.owner;
|
||||
}
|
||||
|
||||
// Try base
|
||||
if (
|
||||
KFPawn(other) == none &&
|
||||
KFMonster(other) == none &&
|
||||
(KFPawn(other.base) != none || KFMonster(other.base) != none)
|
||||
) {
|
||||
other = other.base;
|
||||
if (!other.IsA('KFPawn') && !other.IsA('KFMonster')) {
|
||||
// Try owner
|
||||
if (other.owner.IsA('KFPawn') || other.owner.IsA('KFMonster')) {
|
||||
return other.owner;
|
||||
}
|
||||
// Try base
|
||||
if (other.base.IsA('KFPawn') || other.base.IsA('KFMonster')) {
|
||||
return other.base;
|
||||
}
|
||||
}
|
||||
|
||||
return other;
|
||||
@ -694,16 +687,19 @@ function DoProcessMovement(float delta) {
|
||||
}
|
||||
|
||||
function Stick(Actor target, Vector hitLocation) {
|
||||
local NiceMonster targetZed;
|
||||
local name boneStick;
|
||||
local float distToBone;
|
||||
local float t;
|
||||
local Vector boneStrickOrig;
|
||||
local ExplosionData expData;
|
||||
local Actor resultTarget;
|
||||
local NiceMonster targetZed;
|
||||
local name boneStick;
|
||||
local float distToBone, t;
|
||||
|
||||
if (bGhost) {
|
||||
return;
|
||||
}
|
||||
expData.instigator = instigator;
|
||||
expData.sourceWeapon = sourceWeapon;
|
||||
expData.bulletClass = class;
|
||||
expData.explosionDamageType = charExplosionDamageType;
|
||||
expData.explosionDamage = charExplosionDamage;
|
||||
expData.explosionRadius = charExplosionRadius;
|
||||
@ -712,31 +708,13 @@ function Stick(Actor target, Vector hitLocation) {
|
||||
expData.fuseTime = charFuseTime;
|
||||
expData.explodeOnFuse = charExplodeOnFuse;
|
||||
expData.affectedByScream = charAffectedByScream;
|
||||
expData.sourceWeapon = sourceWeapon;
|
||||
targetZed = NiceMonster(target);
|
||||
|
||||
if (targetZed == none) {
|
||||
expData.bulletClass = class;
|
||||
expData.instigator = instigator;
|
||||
niceRI.ServerStickProjectile(
|
||||
KFHumanPawn(instigator),
|
||||
target,
|
||||
'None',
|
||||
hitLocation - target.location,
|
||||
Rotator(movementDirection),
|
||||
expData
|
||||
);
|
||||
class'NiceProjectileSpawner'.static.StickProjectile(
|
||||
KFHumanPawn(instigator),
|
||||
target,
|
||||
'None',
|
||||
hitLocation - target.location,
|
||||
Rotator(movementDirection),
|
||||
expData
|
||||
);
|
||||
if (!target.IsA('NiceMonster')) {
|
||||
hitLocation -= target.location;
|
||||
boneStick = 'None';
|
||||
resultTarget = target;
|
||||
} else {
|
||||
expData.bulletClass = class;
|
||||
expData.instigator = instigator;
|
||||
targetZed = NiceMonster(target);
|
||||
boneStick = targetZed.GetClosestBone(hitLocation, movementDirection, distToBone);
|
||||
if (CheckHeadshot(targetZed, hitLocation, movementDirection) > 0.0) {
|
||||
boneStick = targetZed.HeadBone;
|
||||
@ -751,23 +729,27 @@ function Stick(Actor target, Vector hitLocation) {
|
||||
t /= VSizeSquared(movementDirection);
|
||||
t *= 0.5;
|
||||
hitLocation = hitLocation + t * movementDirection;
|
||||
niceRI.ServerStickProjectile(
|
||||
KFHumanPawn(instigator),
|
||||
targetZed,
|
||||
boneStick,
|
||||
hitLocation - boneStrickOrig,
|
||||
Rotator(movementDirection),
|
||||
expData
|
||||
);
|
||||
class'NiceProjectileSpawner'.static.StickProjectile(
|
||||
KFHumanPawn(instigator),
|
||||
targetZed,
|
||||
boneStick,
|
||||
hitLocation - boneStrickOrig,
|
||||
Rotator(movementDirection),
|
||||
expData
|
||||
);
|
||||
hitLocation -= boneStrickOrig;
|
||||
resultTarget = targetZed;
|
||||
}
|
||||
|
||||
niceRI.ServerStickProjectile(
|
||||
KFHumanPawn(instigator),
|
||||
resultTarget,
|
||||
boneStick,
|
||||
hitLocation,
|
||||
Rotator(movementDirection),
|
||||
expData
|
||||
);
|
||||
class'NiceProjectileSpawner'.static.StickProjectile(
|
||||
KFHumanPawn(instigator),
|
||||
resultTarget,
|
||||
boneStick,
|
||||
hitLocation,
|
||||
Rotator(movementDirection),
|
||||
expData
|
||||
);
|
||||
|
||||
KillBullet();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user