ClothingEvents.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using Content.Shared.Actions;
  2. using Content.Shared.Clothing.Components;
  3. namespace Content.Shared.Clothing;
  4. /// <summary>
  5. /// Raised directed at a piece of clothing to get the set of layers to show on the wearer's sprite
  6. /// </summary>
  7. public sealed class GetEquipmentVisualsEvent : EntityEventArgs
  8. {
  9. /// <summary>
  10. /// Entity that is wearing the item.
  11. /// </summary>
  12. public readonly EntityUid Equipee;
  13. public readonly string Slot;
  14. /// <summary>
  15. /// The layers that will be added to the entity that is wearing this item.
  16. /// </summary>
  17. /// <remarks>
  18. /// Note that the actual ordering of the layers depends on the order in which they are added to this list;
  19. /// </remarks>
  20. public List<(string, PrototypeLayerData)> Layers = new();
  21. public GetEquipmentVisualsEvent(EntityUid equipee, string slot)
  22. {
  23. Equipee = equipee;
  24. Slot = slot;
  25. }
  26. }
  27. /// <summary>
  28. /// Raised directed at a piece of clothing after its visuals have been updated.
  29. /// </summary>
  30. /// <remarks>
  31. /// Useful for systems/components that modify the visual layers that an item adds to a player. (e.g. RGB memes)
  32. /// </remarks>
  33. public sealed class EquipmentVisualsUpdatedEvent : EntityEventArgs
  34. {
  35. /// <summary>
  36. /// Entity that is wearing the item.
  37. /// </summary>
  38. public readonly EntityUid Equipee;
  39. public readonly string Slot;
  40. /// <summary>
  41. /// The layers that this item is now revealing.
  42. /// </summary>
  43. public HashSet<string> RevealedLayers;
  44. public EquipmentVisualsUpdatedEvent(EntityUid equipee, string slot, HashSet<string> revealedLayers)
  45. {
  46. Equipee = equipee;
  47. Slot = slot;
  48. RevealedLayers = revealedLayers;
  49. }
  50. }
  51. public sealed partial class ToggleMaskEvent : InstantActionEvent { }
  52. /// <summary>
  53. /// Event raised on the mask entity when it is toggled.
  54. /// </summary>
  55. [ByRefEvent]
  56. public readonly record struct ItemMaskToggledEvent(Entity<MaskComponent> Mask, EntityUid? Wearer);
  57. /// <summary>
  58. /// Event raised on the entity wearing the mask when it is toggled.
  59. /// </summary>
  60. [ByRefEvent]
  61. public readonly record struct WearerMaskToggledEvent(Entity<MaskComponent> Mask);
  62. /// <summary>
  63. /// Raised on the clothing entity when it is equipped to a valid slot,
  64. /// as determined by <see cref="ClothingComponent.Slots"/>.
  65. /// </summary>
  66. [ByRefEvent]
  67. public readonly record struct ClothingGotEquippedEvent(EntityUid Wearer, ClothingComponent Clothing);
  68. /// <summary>
  69. /// Raised on the clothing entity when it is unequipped from a valid slot,
  70. /// as determined by <see cref="ClothingComponent.Slots"/>.
  71. /// </summary>
  72. [ByRefEvent]
  73. public readonly record struct ClothingGotUnequippedEvent(EntityUid Wearer, ClothingComponent Clothing);
  74. /// <summary>
  75. /// Raised on an entity when they equip a clothing item to a valid slot,
  76. /// as determined by <see cref="ClothingComponent.Slots"/>.
  77. /// </summary>
  78. [ByRefEvent]
  79. public readonly record struct ClothingDidEquippedEvent(Entity<ClothingComponent> Clothing);
  80. /// <summary>
  81. /// Raised on an entity when they unequip a clothing item from a valid slot,
  82. /// as determined by <see cref="ClothingComponent.Slots"/>.
  83. /// </summary>
  84. [ByRefEvent]
  85. public readonly record struct ClothingDidUnequippedEvent(Entity<ClothingComponent> Clothing);