Class endstone::DamageSource¶
ClassList > endstone > DamageSource
Represents a source of damage.
#include <endstone/damage/damage_source.h>
Public Functions¶
Type | Name |
---|---|
virtual Actor * | getActor () const = 0 Get the actor that caused the damage to occur. |
virtual Actor * | getDamagingActor () const = 0 Get the actor that directly caused the damage. |
virtual std::string_view | getType () const = 0 Get the damage type. |
virtual bool | isIndirect () const = 0 Get if this damage is indirect. |
virtual | ~DamageSource () = default |
Public Functions Documentation¶
function getActor¶
Get the actor that caused the damage to occur.
Not to be confused with DamageSource::getDamagingActor(), the returned actor is the actor to which the damage is ultimately attributed if the receiver is killed. If, for example, the receiver was damaged by a projectile, the shooter/thrower would be returned.
Returns:
an Actor or null
function getDamagingActor¶
Get the actor that directly caused the damage.
Not to be confused with DamageSource::getActor(), the returned actor is the actor that actually inflicted the damage. If, for example, the receiver was damaged by a projectile, the projectile would be returned.
Returns:
an Actor or null
function getType¶
Get the damage type.
Returns:
the damage type
function isIndirect¶
Get if this damage is indirect.
Damage is considered indirect if DamageSource::getActor() is not equal to DamageSource::getDamagingActor(). This will be the case, for example, if a skeleton shot an arrow or a player threw a potion.
Returns:
true if is indirect, false otherwise.
function ~DamageSource¶
The documentation for this class was generated from the following file include/endstone/damage/damage_source.h