Class DamageSource
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
public class DamageSource
- Inheritance
-
DamageSource
- Inherited Members
- Extension Methods
Fields
CauseEntity
The entity that caused this damage, e.g. the entity that threw the SourceEntity projectile, if any
NOTE: will be null for non-projectile damage e.g. melee attacks: to get the attacking entity properly for both melee and projectile damage, use GetCauseEntity()
public Entity CauseEntity
Field Value
DamageOverTimeType
If Duration greater than zero, this damage will be turned into damage overt time effect with this type.
This is used to look for specific types of DoT effects. For example it can be used to stop bleeding with bandages.
public int DamageOverTimeType
Field Value
DamageTier
Tier of the weapon used to damage the entity, if any
public int DamageTier
Field Value
Duration
If is greater than zero, damage will be turned into damage over time and will be fully applied over this time.
If TicksPerDuration is set to 1, it will mean that damage will just be delayed by Duration.
public TimeSpan Duration
Field Value
HitPosition
The relative hit position of where the damage occured.
public Vec3d HitPosition
Field Value
IgnoreInvFrames
public bool IgnoreInvFrames
Field Value
KnockbackStrength
The amount of knockback this damage will incur
public float KnockbackStrength
Field Value
Source
The type of source the damage came from.
public EnumDamageSource Source
Field Value
SourceBlock
The source block the damage came from, if any
public Block SourceBlock
Field Value
SourceEntity
The source entity the damage came from, if any
public Entity SourceEntity
Field Value
SourcePos
the location of the damage source.
public Vec3d SourcePos
Field Value
TicksPerDuration
If Duration greater than zero, total damage will be split into this many portions, each applied in Duration/TicksPerDuration time after another.
public int TicksPerDuration
Field Value
Type
The type of damage that was taken.
public EnumDamageType Type
Field Value
YDirKnockbackDiv
public float YDirKnockbackDiv
Field Value
Properties
DamageOverTimeTypeEnum
public EnumDamageOverTimeEffectType DamageOverTimeTypeEnum { get; set; }
Property Value
Methods
GetAttackAngle(Vec3d, out double, out double)
If we have a hitposition this returns the pitch between the attacker and the attacked position
public bool GetAttackAngle(Vec3d attackedPos, out double attackYaw, out double attackPitch)
Parameters
Returns
GetCauseEntity()
Get the entity that caused the damage. If a projectile like a stone was thrown this will return the entity that threw the stone instead of the stone.
public Entity GetCauseEntity()
Returns
- Entity
The entity that caused the damage
GetSourcePosition()
Fetches the location of the damage source from either SourcePos or SourceEntity
public Vec3d GetSourcePosition()