endstone/damage
Classes
| Name | Description |
|---|---|
DamageSource | Represents a source of damage. |
classDamageSource
Defined in <endstone/damage/damage_source.h>
Represents a source of damage.
Methods
| Name | Description |
|---|---|
~DamageSource | |
getType | Get the damage type. |
getActor | Get the actor that caused the damage to occur. |
getDamagingActor | Get the actor that directly caused the damage. |
isIndirect | Get if this damage is indirect. |
meth~DamageSourcevirtual
~DamageSource() =defaultmethgetTypeabstractconst
std::string_view getType() const =0Get the damage type.
Returns
| Type | Description |
|---|---|
std::string_view | the damage type |
methgetActorabstractconst
Actor* getActor() const =0Get 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.
methgetDamagingActorabstractconst
Actor* getDamagingActor() const =0Get 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.
methisIndirectabstractconst
bool isIndirect() const =0Get 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
| Type | Description |
|---|---|
bool | true if is indirect, false otherwise. |