Class DamageableSystem
Inheritance
Namespace: Content.Shared.Damage
Assembly: Content.Shared.dll
Syntax
public sealed class DamageableSystem : EntitySystem
Methods
| Improve this Doc View SourceDamageChanged(EntityUid, DamageableComponent, DamageSpecifier, Boolean, Nullable<EntityUid>)
If the damage in a DamageableComponent was changed, this function should be called.
Declaration
public void DamageChanged(EntityUid uid, DamageableComponent component, DamageSpecifier damageDelta = null, bool interruptsDoAfters = true, EntityUid? origin = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
DamageableComponent | component | |
DamageSpecifier | damageDelta | |
System.Boolean | interruptsDoAfters | |
System.Nullable<EntityUid> | origin |
Remarks
This updates cached damage information, flags the component as dirty, and raises a damage changed event. The damage changed event is used by other systems, such as damage thresholds.
Initialize()
Declaration
public override void Initialize()
SetAllDamage(EntityUid, DamageableComponent, FixedPoint2)
Sets all damage types supported by a DamageableComponent to the specified value.
Declaration
public void SetAllDamage(EntityUid uid, DamageableComponent component, FixedPoint2 newValue)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
DamageableComponent | component | |
FixedPoint2 | newValue |
SetDamage(EntityUid, DamageableComponent, DamageSpecifier)
Directly sets the damage specifier of a damageable component.
Declaration
public void SetDamage(EntityUid uid, DamageableComponent damageable, DamageSpecifier damage)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
DamageableComponent | damageable | |
DamageSpecifier | damage |
Remarks
Useful for some unfriendly folk. Also ensures that cached values are updated and that a damage changed event is raised.
SetDamageModifierSetId(EntityUid, String, DamageableComponent)
Declaration
public void SetDamageModifierSetId(EntityUid uid, string damageModifierSetId, DamageableComponent comp = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
System.String | damageModifierSetId | |
DamageableComponent | comp |
TryChangeDamage(Nullable<EntityUid>, DamageSpecifier, Boolean, Boolean, DamageableComponent, Nullable<EntityUid>)
Applies damage specified via a DamageSpecifier.
Declaration
public DamageSpecifier TryChangeDamage(EntityUid? uid, DamageSpecifier damage, bool ignoreResistances = false, bool interruptsDoAfters = true, DamageableComponent damageable = null, EntityUid? origin = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<EntityUid> | uid | |
DamageSpecifier | damage | |
System.Boolean | ignoreResistances | |
System.Boolean | interruptsDoAfters | |
DamageableComponent | damageable | |
System.Nullable<EntityUid> | origin |
Returns
Type | Description |
---|---|
DamageSpecifier | Returns a DamageSpecifier with information about the actual damage changes. This will be null if the user had no applicable components that can take damage. |
Remarks
DamageSpecifier is effectively just a dictionary of damage types and damage values. This function just applies the container's resistances (unless otherwise specified) and then changes the stored damage data. Division of group damage into types is managed by DamageSpecifier.