1
0

ActivatableUIComponent.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using Content.Shared.Whitelist;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations;
  4. namespace Content.Shared.UserInterface
  5. {
  6. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  7. public sealed partial class ActivatableUIComponent : Component
  8. {
  9. [DataField(required: true, customTypeSerializer: typeof(EnumSerializer))]
  10. public Enum? Key;
  11. /// <summary>
  12. /// Whether the item must be held in one of the user's hands to work.
  13. /// This is ignored unless <see cref="RequiresComplex"/> is true.
  14. /// </summary>
  15. [ViewVariables(VVAccess.ReadWrite)]
  16. [DataField]
  17. public bool InHandsOnly;
  18. [DataField]
  19. public bool SingleUser;
  20. [ViewVariables(VVAccess.ReadWrite)]
  21. [DataField]
  22. public bool AdminOnly;
  23. [DataField]
  24. public LocId VerbText = "ui-verb-toggle-open";
  25. /// <summary>
  26. /// Whether you need to be able to do complex interactions to operate this UI.
  27. /// </summary>
  28. /// <remarks>
  29. /// This should probably be true for most machines & computers, but there will still be UIs that represent a
  30. /// more generic interaction / configuration that might not require complex.
  31. /// </remarks>
  32. [ViewVariables(VVAccess.ReadWrite)]
  33. [DataField]
  34. public bool RequiresComplex = true;
  35. /// <summary>
  36. /// Entities that are required to open this UI.
  37. /// </summary>
  38. [DataField, ViewVariables(VVAccess.ReadWrite)]
  39. public EntityWhitelist? RequiredItems;
  40. /// <summary>
  41. /// If true, then this UI can only be opened via verbs. I.e., normal interactions/activations will not open
  42. /// the UI.
  43. /// </summary>
  44. [DataField, ViewVariables(VVAccess.ReadWrite)]
  45. public bool VerbOnly;
  46. /// <summary>
  47. /// Whether spectators (non-admin ghosts) should be allowed to view this UI.
  48. /// </summary>
  49. [ViewVariables(VVAccess.ReadWrite)]
  50. [DataField]
  51. public bool BlockSpectators;
  52. /// <summary>
  53. /// Whether the item must be in the user's currently selected/active hand.
  54. /// This is ignored unless <see cref="InHandsOnly"/> is true.
  55. /// </summary>
  56. [ViewVariables(VVAccess.ReadWrite)]
  57. [DataField]
  58. public bool RequireActiveHand = true;
  59. /// <summary>
  60. /// The client channel currently using the object, or null if there's none/not single user.
  61. /// NOTE: DO NOT DIRECTLY SET, USE ActivatableUISystem.SetCurrentSingleUser
  62. /// </summary>
  63. [DataField, AutoNetworkedField]
  64. public EntityUid? CurrentSingleUser;
  65. }
  66. }