Duke3D: Introduce actor event 'EVENT_PREACTORDAMAGE'
This event is executed when an actor runs A_IncurDamage()
, and is
placed just before subtracting htextra
from extra
and updating
the actor's owner (i.e. just before damage is applied to the actor).
For useractors, this normally occurs when ifhitweapon
is called.
Set RETURN to a nonzero value to skip applying the damage. This
will also cause the ifhitweapon
conditional to skip the branch.
Note that doing so will not automatically reset htextra to 0.
This event has some significant differences to EVENT_DAMAGESPRITE
that make it worthwhile having:
- This event is only executed when an actor actually applies damage, rather than whenever a sprite is hit by a projectile. Allows you to cancel applying damage and taking the
ifhitweapon
branch. - This event does not suffer from the problem of radius damage potentially reducing
htextra
before damage is applied. This makes it possible to accurately detect whether an actor will die from the damage taken, which is not possible withEVENT_DAMAGESPRITE
. - No need to declare the picnum being hit using
damageeventtile
, runs for every useractor that callsifhitweapon
. - Current player is defined within the event. This is not defined with the
DAMAGESPRITE
events.
Edited by Dino Bollinger