ChameleonClothingComponent.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using Content.Shared.Clothing.EntitySystems;
  2. using Content.Shared.Inventory;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Prototypes;
  5. using Robust.Shared.Serialization;
  6. namespace Content.Shared.Clothing.Components;
  7. /// <summary>
  8. /// Allow players to change clothing sprite to any other clothing prototype.
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
  11. [Access(typeof(SharedChameleonClothingSystem))]
  12. public sealed partial class ChameleonClothingComponent : Component
  13. {
  14. /// <summary>
  15. /// Filter possible chameleon options by their slot flag.
  16. /// </summary>
  17. [ViewVariables(VVAccess.ReadOnly)]
  18. [DataField(required: true)]
  19. public SlotFlags Slot;
  20. /// <summary>
  21. /// EntityPrototype id that chameleon item is trying to mimic.
  22. /// </summary>
  23. [ViewVariables(VVAccess.ReadOnly)]
  24. [DataField(required: true), AutoNetworkedField]
  25. public EntProtoId? Default;
  26. /// <summary>
  27. /// Current user that wears chameleon clothing.
  28. /// </summary>
  29. [ViewVariables]
  30. public EntityUid? User;
  31. /// <summary>
  32. /// Filter possible chameleon options by a tag in addition to WhitelistChameleon.
  33. /// </summary>
  34. [DataField]
  35. public string? RequireTag;
  36. }
  37. [Serializable, NetSerializable]
  38. public sealed class ChameleonBoundUserInterfaceState : BoundUserInterfaceState
  39. {
  40. public readonly SlotFlags Slot;
  41. public readonly string? SelectedId;
  42. public readonly string? RequiredTag;
  43. public ChameleonBoundUserInterfaceState(SlotFlags slot, string? selectedId, string? requiredTag)
  44. {
  45. Slot = slot;
  46. SelectedId = selectedId;
  47. RequiredTag = requiredTag;
  48. }
  49. }
  50. [Serializable, NetSerializable]
  51. public sealed class ChameleonPrototypeSelectedMessage : BoundUserInterfaceMessage
  52. {
  53. public readonly string SelectedId;
  54. public ChameleonPrototypeSelectedMessage(string selectedId)
  55. {
  56. SelectedId = selectedId;
  57. }
  58. }
  59. [Serializable, NetSerializable]
  60. public enum ChameleonUiKey : byte
  61. {
  62. Key
  63. }