- added a callback for when damage is drained from a target.

This commit is contained in:
Christoph Oelckers 2017-03-29 20:25:54 +02:00
parent 356144a537
commit d36f656caf
2 changed files with 11 additions and 0 deletions

View file

@ -1415,6 +1415,12 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
} }
} }
IFVIRTUALPTR(source, AActor, OnDrain)
{
VMValue params[] = { source, target, draindamage, mod.GetIndex() };
VMReturn ret(&draindamage);
GlobalVMStack.Call(func, params, countof(params), &ret, 1);
}
if ( P_GiveBody( source, int(draindamage * damage))) if ( P_GiveBody( source, int(draindamage * damage)))
{ {
S_Sound(source, CHAN_ITEM, "*drainhealth", 1, ATTN_NORM ); S_Sound(source, CHAN_ITEM, "*drainhealth", 1, ATTN_NORM );

View file

@ -489,6 +489,11 @@ class Actor : Thinker native
return Obituary; return Obituary;
} }
virtual int OnDrain(Actor victim, int damage, Name dmgtype)
{
return damage;
}
native virtual bool OkayToSwitchTarget(Actor other); native virtual bool OkayToSwitchTarget(Actor other);
native static class<Actor> GetReplacement(class<Actor> cls); native static class<Actor> GetReplacement(class<Actor> cls);
native static class<Actor> GetReplacee(class<Actor> cls); native static class<Actor> GetReplacee(class<Actor> cls);