Don't track fall damage if monster fall damage is disabled.

This commit is contained in:
Mari the Deer 2022-10-23 23:36:51 +02:00
commit 591e9dcf28
3 changed files with 33 additions and 5 deletions

View file

@ -189,6 +189,7 @@ Class SWWMDamageAccumulator : Inventory
Class SWWMWhoPushedMe : Inventory
{
Actor instigator;
int killtimer;
static void SetInstigator( Actor b, Actor whomst )
{
@ -197,6 +198,7 @@ Class SWWMWhoPushedMe : Inventory
if ( ffd )
{
ffd.instigator = whomst;
ffd.killtimer = 0; // cancel kill timer
return;
}
ffd = SWWMWhoPushedMe(Spawn("SWWMWhoPushedMe"));
@ -217,6 +219,28 @@ Class SWWMWhoPushedMe : Inventory
return null;
}
override void OwnerDied()
{
Super.OwnerDied();
if ( killtimer > 0 ) return;
killtimer = 5;
}
override void DoEffect()
{
Super.DoEffect();
if ( killtimer <= 0 ) return;
killtimer--;
if ( killtimer > 0 ) return;
Destroy();
}
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags )
{
if ( !passive || (damageType != 'Falling') || (killtimer > 0) ) return;
killtimer = 5;
}
default
{
+INVENTORY.UNTOSSABLE;