1
0

DamageOnAttackedProtectionComponent.cs 1.1 KB

1234567891011121314151617181920212223242526272829
  1. using Content.Shared.Inventory;
  2. using Robust.Shared.GameStates;
  3. namespace Content.Shared.Damage.Components;
  4. /// <summary>
  5. /// This component is added to entities to protect them from being damaged
  6. /// when attacking objects with the <see cref="DamageOnAttackedComponent"/>
  7. /// If the entity has sufficient protection, the entity will take no damage.
  8. /// </summary>
  9. [RegisterComponent, NetworkedComponent]
  10. public sealed partial class DamageOnAttackedProtectionComponent : Component, IClothingSlots
  11. {
  12. /// <summary>
  13. /// How much and what kind of damage to protect the user from
  14. /// when interacting with something with <see cref="DamageOnInteractComponent"/>
  15. /// </summary>
  16. [DataField(required: true)]
  17. public DamageModifierSet DamageProtection = default!;
  18. /// <summary>
  19. /// Only protects if the item is in the correct slot
  20. /// i.e. having gloves in your pocket doesn't protect you, it has to be on your hands
  21. /// Set slots to NONE if it works while you hold the item in your main hand
  22. /// </summary>
  23. [DataField]
  24. public SlotFlags Slots { get; set; } = SlotFlags.WITHOUT_POCKET;
  25. }