ToggleClothingComponent.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using Content.Shared.Actions;
  2. using Content.Shared.Clothing.EntitySystems;
  3. using Content.Shared.Item.ItemToggle.Components;
  4. using Content.Shared.Toggleable;
  5. using Robust.Shared.GameStates;
  6. using Robust.Shared.Prototypes;
  7. namespace Content.Shared.Clothing.Components;
  8. /// <summary>
  9. /// Clothing that can be enabled and disabled with an action.
  10. /// Requires <see cref="ItemToggleComponent"/>.
  11. /// </summary>
  12. /// <remarks>
  13. /// Not to be confused with <see cref="ToggleableClothingComponent"/> for hardsuit helmets and such.
  14. /// </remarks>
  15. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  16. [Access(typeof(ToggleClothingSystem))]
  17. public sealed partial class ToggleClothingComponent : Component
  18. {
  19. /// <summary>
  20. /// The action to add when equipped, even if not worn.
  21. /// This must raise <see cref="ToggleActionEvent"/> to then get handled.
  22. /// </summary>
  23. [DataField(required: true)]
  24. public EntProtoId<InstantActionComponent> Action = string.Empty;
  25. [DataField, AutoNetworkedField]
  26. public EntityUid? ActionEntity;
  27. /// <summary>
  28. /// If true, automatically disable the clothing after unequipping it.
  29. /// </summary>
  30. [DataField]
  31. public bool DisableOnUnequip;
  32. /// <summary>
  33. /// If true, the clothes must equip for adding action.
  34. /// </summary>
  35. [DataField]
  36. public bool MustEquip = true;
  37. }
  38. /// <summary>
  39. /// Raised on the clothing when being equipped to see if it should add the action.
  40. /// </summary>
  41. [ByRefEvent]
  42. public record struct ToggleClothingCheckEvent(EntityUid User, bool Cancelled = false);