1
0

AtmosMonitorComponent.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using Content.Shared.Atmos;
  2. using Content.Shared.Atmos.Monitor;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
  5. namespace Content.Server.Atmos.Monitor.Components;
  6. [RegisterComponent]
  7. public sealed partial class AtmosMonitorComponent : Component
  8. {
  9. // Whether this monitor can send alarms,
  10. // or recieve atmos command events.
  11. //
  12. // Useful for wires; i.e., pulsing a monitor wire
  13. // will make it send an alert, and cutting
  14. // it will make it so that alerts are no longer
  15. // sent/receieved.
  16. //
  17. // Note that this cancels every single network
  18. // event, including ones that may not be
  19. // related to atmos monitor events.
  20. [DataField("netEnabled")]
  21. public bool NetEnabled = true;
  22. [DataField("temperatureThresholdId", customTypeSerializer: (typeof(PrototypeIdSerializer<AtmosAlarmThresholdPrototype>)))]
  23. public string? TemperatureThresholdId;
  24. [DataField("temperatureThreshold")]
  25. public AtmosAlarmThreshold? TemperatureThreshold;
  26. [DataField("pressureThresholdId", customTypeSerializer: (typeof(PrototypeIdSerializer<AtmosAlarmThresholdPrototype>)))]
  27. public string? PressureThresholdId;
  28. [DataField("pressureThreshold")]
  29. public AtmosAlarmThreshold? PressureThreshold;
  30. // monitor fire - much different from temperature
  31. // since there's events for fire, setting this to true
  32. // will make the atmos monitor act like a smoke detector,
  33. // immediately signalling danger if there's a fire
  34. [DataField("monitorFire")]
  35. public bool MonitorFire = false;
  36. [DataField("gasThresholdPrototypes",
  37. customTypeSerializer:typeof(PrototypeIdValueDictionarySerializer<Gas, AtmosAlarmThresholdPrototype>))]
  38. public Dictionary<Gas, string>? GasThresholdPrototypes;
  39. [DataField("gasThresholds")]
  40. public Dictionary<Gas, AtmosAlarmThreshold>? GasThresholds;
  41. /// <summary>
  42. /// Stores a reference to the gas on the tile this entity is on (or the pipe network it monitors; see <see cref="MonitorsPipeNet"/>).
  43. /// </summary>
  44. [ViewVariables]
  45. public GasMixture? TileGas;
  46. // Stores the last alarm state of this alarm.
  47. [DataField("lastAlarmState")]
  48. public AtmosAlarmType LastAlarmState = AtmosAlarmType.Normal;
  49. [DataField("trippedThresholds")]
  50. public HashSet<AtmosMonitorThresholdType> TrippedThresholds = new();
  51. /// <summary>
  52. /// Registered devices in this atmos monitor. Alerts will be sent directly
  53. /// to these devices.
  54. /// </summary>
  55. [DataField("registeredDevices")]
  56. public HashSet<string> RegisteredDevices = new();
  57. /// <summary>
  58. /// Specifies whether this device monitors its own internal pipe network rather than the surrounding atmosphere.
  59. /// </summary>
  60. /// <remarks>
  61. /// If 'true', the entity will require a NodeContainerComponent with one or more PipeNodes to function.
  62. /// </remarks>
  63. [DataField]
  64. public bool MonitorsPipeNet = false;
  65. /// <summary>
  66. /// Specifies the name of the pipe node that this device is monitoring.
  67. /// </summary>
  68. [DataField]
  69. public string NodeNameMonitoredPipe = "monitored";
  70. }