SpecialBlastHandling
virtual bool SpecialBlastHandling (Actor source, double strength)
Usage
This virtual function is called on actors when they're blasted by A_Blast or BlastActor. Allows adding custom behavior to modify how actors react to being blasted.
Parameters
- Actor source
- Pointer to the actor responsible for blasting.
- double strength
- The strength of the blast. Has to be explicitly passted by A_Blast, using its strength argument.
Return values
- bool — if the function returns
true
, the actor will be blasted as usual. Iffalse
is returned, the actor ignores the blast.
ZScript definition
Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub. |
In the base Actor class this function doesn't do anything special:
virtual bool SpecialBlastHandling (Actor source, double strength)
{
return true;
}
Examples
HolySpirit, the wraiths fired by the Cleric's Wraithverge weapon in Hexen, has a special reaction to being blasted: the wraith will change allegiance and hunt down its original shooter, while the actor that blasted it becomes its owner. This is intended for deathmatch games, where other players can reflect Cleric's wraiths with a Disc of Repulsion (which uses A_Blast).
(Reminder: since the wraiths are projectiles, the "owner" is stored in the target
pointer, while the actor the wraith is hunting is stored in its tracer
pointer. See here how pointers work in projectiles.)
override bool SpecialBlastHandling (Actor source, double strength)
{
if (tracer == source)
{
tracer = target;
target = source;
}
return true;
}