SuitSensorComponent.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using Content.Shared.Medical.SuitSensor;
  2. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  3. namespace Content.Server.Medical.SuitSensors;
  4. /// <summary>
  5. /// Tracking device, embedded in almost all uniforms and jumpsuits.
  6. /// If enabled, will report to crew monitoring console owners position and status.
  7. /// </summary>
  8. [RegisterComponent, AutoGenerateComponentPause]
  9. [Access(typeof(SuitSensorSystem))]
  10. public sealed partial class SuitSensorComponent : Component
  11. {
  12. /// <summary>
  13. /// Choose a random sensor mode when item is spawned.
  14. /// </summary>
  15. [DataField]
  16. public bool RandomMode = true;
  17. /// <summary>
  18. /// If true user can't change suit sensor mode
  19. /// </summary>
  20. [DataField]
  21. public bool ControlsLocked = false;
  22. /// <summary>
  23. /// How much time it takes to change another player's sensors
  24. /// </summary>
  25. [DataField]
  26. public float SensorsTime = 1.75f;
  27. /// <summary>
  28. /// Current sensor mode. Can be switched by user verbs.
  29. /// </summary>
  30. [DataField]
  31. public SuitSensorMode Mode = SuitSensorMode.SensorOff;
  32. /// <summary>
  33. /// Activate sensor if user wear it in this slot.
  34. /// </summary>
  35. [DataField]
  36. public string ActivationSlot = "jumpsuit";
  37. /// <summary>
  38. /// Activate sensor if user has this in a sensor-compatible container.
  39. /// </summary>
  40. [DataField]
  41. public string? ActivationContainer;
  42. /// <summary>
  43. /// How often does sensor update its owners status (in seconds). Limited by the system update rate.
  44. /// </summary>
  45. [DataField]
  46. public TimeSpan UpdateRate = TimeSpan.FromSeconds(2f);
  47. /// <summary>
  48. /// Current user that wears suit sensor. Null if nobody wearing it.
  49. /// </summary>
  50. [ViewVariables]
  51. public EntityUid? User = null;
  52. /// <summary>
  53. /// Next time when sensor updated owners status
  54. /// </summary>
  55. [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
  56. [AutoPausedField]
  57. public TimeSpan NextUpdate = TimeSpan.Zero;
  58. /// <summary>
  59. /// The station this suit sensor belongs to. If it's null the suit didn't spawn on a station and the sensor doesn't work.
  60. /// </summary>
  61. [DataField("station")]
  62. public EntityUid? StationId = null;
  63. /// <summary>
  64. /// The server the suit sensor sends it state to.
  65. /// The suit sensor will try connecting to a new server when no server is connected.
  66. /// It does this by calling the servers entity system for performance reasons.
  67. /// </summary>
  68. [DataField("server")]
  69. public string? ConnectedServer = null;
  70. /// <summary>
  71. /// The previous mode of the suit. This is used to restore the state when an EMP effect ends.
  72. /// </summary>
  73. [DataField, ViewVariables]
  74. public SuitSensorMode PreviousMode = SuitSensorMode.SensorOff;
  75. /// <summary>
  76. /// The previous locked status of the controls. This is used to restore the state when an EMP effect ends.
  77. /// This keeps prisoner jumpsuits/internal implants from becoming unlocked after an EMP.
  78. /// </summary>
  79. [DataField, ViewVariables]
  80. public bool PreviousControlsLocked = false;
  81. }