ArmorComponent.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Content.Shared.Damage;
  2. using Content.Shared.Inventory;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Utility;
  5. namespace Content.Shared.Armor;
  6. /// <summary>
  7. /// Used for clothing that reduces damage when worn.
  8. /// </summary>
  9. [RegisterComponent, NetworkedComponent, Access(typeof(SharedArmorSystem))]
  10. public sealed partial class ArmorComponent : Component
  11. {
  12. /// <summary>
  13. /// The damage reduction
  14. /// </summary>
  15. [DataField(required: true)]
  16. public DamageModifierSet Modifiers = default!;
  17. /// <summary>
  18. /// A multiplier applied to the calculated point value
  19. /// to determine the monetary value of the armor
  20. /// </summary>
  21. [DataField]
  22. public float PriceMultiplier = 1;
  23. /// <summary>
  24. /// If true, you can examine the armor to see the protection. If false, the verb won't appear.
  25. /// </summary>
  26. [DataField]
  27. public bool ShowArmorOnExamine = true;
  28. }
  29. /// <summary>
  30. /// Event raised on an armor entity to get additional examine text relating to its armor.
  31. /// </summary>
  32. /// <param name="Msg"></param>
  33. [ByRefEvent]
  34. public record struct ArmorExamineEvent(FormattedMessage Msg);
  35. /// <summary>
  36. /// A Relayed inventory event, gets the total Armor for all Inventory slots defined by the Slotflags in TargetSlots
  37. /// </summary>
  38. public sealed class CoefficientQueryEvent : EntityEventArgs, IInventoryRelayEvent
  39. {
  40. /// <summary>
  41. /// All slots to relay to
  42. /// </summary>
  43. public SlotFlags TargetSlots { get; set; }
  44. /// <summary>
  45. /// The Total of all Coefficients.
  46. /// </summary>
  47. public DamageModifierSet DamageModifiers { get; set; } = new DamageModifierSet();
  48. public CoefficientQueryEvent(SlotFlags slots)
  49. {
  50. TargetSlots = slots;
  51. }
  52. }