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

@ -85,8 +85,9 @@ extend Class SWWMHandler
}
}
if ( !e.DamageSource || !e.DamageSource.player ) return;
// fall dmg
SWWMWhoPushedMe.SetInstigator(e.Thing,e.DamageSource);
// fall dmg tracking
if ( !e.Thing.player && (e.Thing.bFALLDAMAGE || level.monsterfallingdamage) )
SWWMWhoPushedMe.SetInstigator(e.Thing,e.DamageSource);
dealtdamage[e.DamageSource.PlayerNumber()] = true;
let s = SWWMStats.Find(e.DamageSource.player);
if ( s ) // deathmatch telefrag-on-spawn may cause this to be null
@ -151,7 +152,10 @@ extend Class SWWMHandler
// fall damage tracking hack
let src = e.DamageSource;
if ( (e.DamageType == 'Falling') && !e.DamageSource )
src = SWWMWhoPushedMe.RecallInstigator(e.Thing);
{
let inst = SWWMWhoPushedMe.RecallInstigator(e.Thing);
if ( inst ) src = inst;
}
if ( (!src || !src.player || (src == e.Thing)) ) return;
let inflictor = e.Inflictor;
if ( inflictor is 'SWWMPuff' ) inflictor = inflictor.master;

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;