DamageOnInteractProtectionComponent.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 interacting with objects with the <see cref="DamageOnInteractComponent"/>
  7. /// If the entity has sufficient protection, interaction with the object is not cancelled.
  8. /// This allows the user to do things like remove a lightbulb.
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent]
  11. public sealed partial class DamageOnInteractProtectionComponent : Component, IClothingSlots
  12. {
  13. /// <summary>
  14. /// How much and what kind of damage to protect the user from
  15. /// when interacting with something with <see cref="DamageOnInteractComponent"/>
  16. /// </summary>
  17. [DataField(required: true)]
  18. public DamageModifierSet DamageProtection = default!;
  19. /// <summary>
  20. /// Only protects if the item is in the correct slot
  21. /// i.e. having gloves in your pocket doesn't protect you, it has to be on your hands
  22. /// </summary>
  23. [DataField]
  24. public SlotFlags Slots { get; set; } = SlotFlags.GLOVES;
  25. }