#nullable enable using System; using System.Collections.Generic; using Content.Shared.Damage; using Content.Shared.GameObjects.EntitySystems; using Robust.Shared.Interfaces.GameObjects; namespace Content.Shared.GameObjects.Components.Damage { public interface IDamageableComponent : IComponent, IExAct { /// /// Called when the entity's values change. /// Of note is that a "deal 0 damage" call will still trigger this event /// (including both damage negated by resistance or simply inputting 0 as /// the amount of damage to deal). /// event Action HealthChangedEvent; /// /// Sum of all damages taken. /// int TotalDamage { get; } /// /// The amount of damage mapped by . /// IReadOnlyDictionary DamageClasses { get; } /// /// The amount of damage mapped by . /// IReadOnlyDictionary DamageTypes { get; } /// /// The damage flags on this component. /// DamageFlag Flags { get; } /// /// Adds a flag to this component. /// /// The flag to add. void AddFlag(DamageFlag flag); /// /// Checks whether or not this component has a specific flag. /// /// The flag to check for. /// True if it has the flag, false otherwise. bool HasFlag(DamageFlag flag); /// /// Removes a flag from this component. /// /// The flag to remove. void RemoveFlag(DamageFlag flag); bool SupportsDamageClass(DamageClass @class); bool SupportsDamageType(DamageType type); /// /// Gets the amount of damage of a type. /// /// The type to get the damage of. /// The amount of damage of that type. /// /// True if the given is supported, false otherwise. /// bool TryGetDamage(DamageType type, out int damage); /// /// Gets the amount of damage of a class. /// /// The class to get the damage of. /// The amount of damage of that class. /// /// True if the given is supported, false otherwise. /// bool TryGetDamage(DamageClass @class, out int damage); /// /// Changes the specified , applying /// resistance values only if it is damage. /// /// Type of damage being changed. /// /// Amount of damage being received (positive for damage, negative for heals). /// /// /// Whether or not to ignore resistances. /// Healing always ignores resistances, regardless of this input. /// /// /// The entity that dealt or healed the damage, if any. /// /// /// Extra parameters that some components may require, such as a specific limb to target. /// /// /// False if the given type is not supported or improper /// were provided; true otherwise. /// bool ChangeDamage( DamageType type, int amount, bool ignoreResistances, IEntity? source = null, DamageChangeParams? extraParams = null); /// /// Changes the specified , applying /// resistance values only if it is damage. /// Spreads amount evenly between the s /// represented by that class. /// /// Class of damage being changed. /// /// Amount of damage being received (positive for damage, negative for heals). /// /// /// Whether to ignore resistances. /// Healing always ignores resistances, regardless of this input. /// /// Entity that dealt or healed the damage, if any. /// /// Extra parameters that some components may require, /// such as a specific limb to target. /// /// /// Returns false if the given class is not supported or improper /// were provided; true otherwise. /// bool ChangeDamage( DamageClass @class, int amount, bool ignoreResistances, IEntity? source = null, DamageChangeParams? extraParams = null); /// /// Forcefully sets the specified to the given /// value, ignoring resistance values. /// /// Type of damage being changed. /// New damage value to be set. /// Entity that set the new damage value. /// /// Extra parameters that some components may require, /// such as a specific limb to target. /// /// /// Returns false if the given type is not supported or improper /// were provided; true otherwise. /// bool SetDamage( DamageType type, int newValue, IEntity? source = null, DamageChangeParams? extraParams = null); /// /// Sets all damage values to zero. /// void Heal(); /// /// Invokes the HealthChangedEvent with the current values of health. /// void ForceHealthChangedEvent(); } }