NiceMonsterController SetEnemy newEnemy none fix

This commit is contained in:
Shtoyan 2022-01-22 20:42:34 +04:00
parent de6567f15a
commit 9c4ec1b095

View File

@ -414,36 +414,47 @@ Begin:
} }
WhatToDoNext(99); WhatToDoNext(99);
} }
function bool SetEnemy( pawn newEnemy, function bool SetEnemy( pawn newEnemy,
optional bool bHateMonster, optional bool bHateMonster,
optional float MonsterHateChanceOverride){ optional float MonsterHateChanceOverride)
{
local NiceMonster niceZed; local NiceMonster niceZed;
local NiceZombieFleshpound niceFP; local NiceZombieFleshpound niceFP;
local bool bCanForceFight; local bool bCanForceFight;
// Can we fight anything? // Can we fight anything?
niceZed = NiceMonster(pawn); niceZed = NiceMonster(pawn);
niceFP = NiceZombieFleshpound(niceZed); niceFP = NiceZombieFleshpound(niceZed);
if (niceZed != none) if (niceZed != none)
{
bCanForceFight = bCanForceFight =
KFMonster(pawn).HeadHealth <= 0 KFMonster(pawn).HeadHealth <= 0
|| KFMonster(pawn).bDecapitated || KFMonster(pawn).bDecapitated
|| newEnemy.Health <= 15; || (newEnemy != none && newEnemy.Health <= 15);
}
if (niceFP != none && niceFP.IsInState('RageCharging')) if (niceFP != none && niceFP.IsInState('RageCharging'))
bCanForceFight = false; bCanForceFight = false;
if (newEnemy != none) if (newEnemy != none)
bCanForceFight = bCanForceFight bCanForceFight = bCanForceFight && newEnemy.Health > 0 && newEnemy != enemy;
&& newEnemy.Health > 0 && newEnemy != enemy;
else else
bCanForceFight = false; bCanForceFight = false;
// Do fight if we can // Do fight if we can
if(bCanForceFight){ if(bCanForceFight)
{
ChangeEnemy(newEnemy, true); ChangeEnemy(newEnemy, true);
FightEnemy(false); FightEnemy(false);
return true; return true;
} }
// Otherwise - do the usual stupid stuff // Otherwise - do the usual stupid stuff
return super.SetEnemy(newEnemy, bHateMonster, monsterHateChanceOverride); return super.SetEnemy(newEnemy, bHateMonster, monsterHateChanceOverride);
} }
simulated function AddKillAssistant(Controller PC, float damage){ simulated function AddKillAssistant(Controller PC, float damage){
local bool bIsalreadyAssistant; local bool bIsalreadyAssistant;
local int i; local int i;