file-scoped namespaces

This commit is contained in:
vulppine
2022-08-23 10:55:46 -07:00
parent df25715ed3
commit b3a4ef9997
20 changed files with 2503 additions and 2525 deletions

View File

@@ -3,25 +3,24 @@ using Content.Shared.Atmos.Monitor.Components;
using Content.Shared.Atmos.Piping.Unary.Components;
using Robust.Shared.Network;
namespace Content.Server.Atmos.Monitor.Components
namespace Content.Server.Atmos.Monitor.Components;
[RegisterComponent]
public sealed class AirAlarmComponent : Component
{
[RegisterComponent]
public sealed class AirAlarmComponent : Component
{
[ViewVariables] public AirAlarmMode CurrentMode { get; set; } = AirAlarmMode.Filtering;
[ViewVariables] public AirAlarmMode CurrentMode { get; set; } = AirAlarmMode.Filtering;
// Remember to null this afterwards.
[ViewVariables] public IAirAlarmModeUpdate? CurrentModeUpdater { get; set; }
// Remember to null this afterwards.
[ViewVariables] public IAirAlarmModeUpdate? CurrentModeUpdater { get; set; }
[ViewVariables] public AirAlarmTab CurrentTab { get; set; }
[ViewVariables] public AirAlarmTab CurrentTab { get; set; }
public Dictionary<string, IAtmosDeviceData> DeviceData = new();
public Dictionary<string, GasVentPumpData> VentData = new();
public Dictionary<string, GasVentScrubberData> ScrubberData = new();
public Dictionary<string, AtmosSensorData> SensorData = new();
public Dictionary<string, IAtmosDeviceData> DeviceData = new();
public Dictionary<string, GasVentPumpData> VentData = new();
public Dictionary<string, GasVentScrubberData> ScrubberData = new();
public Dictionary<string, AtmosSensorData> SensorData = new();
public HashSet<NetUserId> ActivePlayers = new();
public HashSet<NetUserId> ActivePlayers = new();
public bool CanSync = true;
}
public bool CanSync = true;
}

View File

@@ -3,60 +3,58 @@ using Content.Shared.Tag;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
namespace Content.Server.Atmos.Monitor.Components
namespace Content.Server.Atmos.Monitor.Components;
// AtmosAlarmables are entities that can be alarmed
// by a linked AtmosMonitor (alarmer?) if a threshold
// is passed in some way. The intended use is to
// do something in case something dangerous happens,
// e.g., activate firelocks in case a temperature
// threshold is reached
//
// It goes:
//
// AtmosMonitor -> AtmosDeviceUpdateEvent
// -> Threshold calculation
// -> AtmosAlarmEvent
// -> Everything linked to that monitor (targetted)
/// <summary>
/// A component to add to device network devices if you want them to be alarmed
/// by an atmospheric alarmer. This will store every single alert received, and
/// calculate the highest alert based on the alerts received. Equally, if you
/// link other alarmables to this, it will store the alerts from them to
/// calculate the highest network alert.
/// </summary>
[RegisterComponent]
public sealed class AtmosAlarmableComponent : Component
{
// AtmosAlarmables are entities that can be alarmed
// by a linked AtmosMonitor (alarmer?) if a threshold
// is passed in some way. The intended use is to
// do something in case something dangerous happens,
// e.g., activate firelocks in case a temperature
// threshold is reached
//
// It goes:
//
// AtmosMonitor -> AtmosDeviceUpdateEvent
// -> Threshold calculation
// -> AtmosAlarmEvent
// -> Everything linked to that monitor (targetted)
[ViewVariables]
public readonly Dictionary<string, AtmosMonitorAlarmType> NetworkAlarmStates = new();
[ViewVariables] public AtmosMonitorAlarmType LastAlarmState = AtmosMonitorAlarmType.Normal;
[ViewVariables] public bool IgnoreAlarms { get; set; } = false;
[DataField("alarmSound")]
public SoundSpecifier AlarmSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/alarm.ogg");
[DataField("alarmVolume")]
public float AlarmVolume { get; set; } = -10;
/// <summary>
/// A component to add to device network devices if you want them to be alarmed
/// by an atmospheric alarmer. This will store every single alert received, and
/// calculate the highest alert based on the alerts received. Equally, if you
/// link other alarmables to this, it will store the alerts from them to
/// calculate the highest network alert.
/// List of tags to check for when synchronizing alarms.
/// </summary>
[RegisterComponent]
public sealed class AtmosAlarmableComponent : Component
{
[ViewVariables]
public readonly Dictionary<string, AtmosMonitorAlarmType> NetworkAlarmStates = new();
[DataField("syncWith", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<TagPrototype>))]
public HashSet<string> SyncWithTags { get; } = new();
[ViewVariables] public AtmosMonitorAlarmType LastAlarmState = AtmosMonitorAlarmType.Normal;
[DataField("monitorAlertTypes")]
public HashSet<AtmosMonitorThresholdType>? MonitorAlertTypes { get; }
[ViewVariables] public bool IgnoreAlarms { get; set; } = false;
[DataField("alarmSound")]
public SoundSpecifier AlarmSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/alarm.ogg");
[DataField("alarmVolume")]
public float AlarmVolume { get; set; } = -10;
/// <summary>
/// List of tags to check for when synchronizing alarms.
/// </summary>
[DataField("syncWith", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<TagPrototype>))]
public HashSet<string> SyncWithTags { get; } = new();
[DataField("monitorAlertTypes")]
public HashSet<AtmosMonitorThresholdType>? MonitorAlertTypes { get; }
/// <summary>
/// If this device should receive only. If it can only
/// receive, that means that attempting to sync outwards
/// will result in nothing happening.
/// </summary>
[DataField("receiveOnly")]
public bool ReceiveOnly { get; }
}
/// <summary>
/// If this device should receive only. If it can only
/// receive, that means that attempting to sync outwards
/// will result in nothing happening.
/// </summary>
[DataField("receiveOnly")]
public bool ReceiveOnly { get; }
}

View File

@@ -3,68 +3,67 @@ using Content.Shared.Atmos.Monitor;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Atmos.Monitor.Components
namespace Content.Server.Atmos.Monitor.Components;
[RegisterComponent]
public sealed class AtmosMonitorComponent : Component
{
[RegisterComponent]
public sealed class AtmosMonitorComponent : Component
{
// Whether this monitor can send alarms,
// or recieve atmos command events.
//
// Useful for wires; i.e., pulsing a monitor wire
// will make it send an alert, and cutting
// it will make it so that alerts are no longer
// sent/receieved.
//
// Note that this cancels every single network
// event, including ones that may not be
// related to atmos monitor events.
[ViewVariables]
public bool NetEnabled = true;
// Whether this monitor can send alarms,
// or recieve atmos command events.
//
// Useful for wires; i.e., pulsing a monitor wire
// will make it send an alert, and cutting
// it will make it so that alerts are no longer
// sent/receieved.
//
// Note that this cancels every single network
// event, including ones that may not be
// related to atmos monitor events.
[ViewVariables]
public bool NetEnabled = true;
[DataField("temperatureThreshold", customTypeSerializer: (typeof(PrototypeIdSerializer<AtmosAlarmThreshold>)))]
public readonly string? TemperatureThresholdId;
[DataField("temperatureThreshold", customTypeSerializer: (typeof(PrototypeIdSerializer<AtmosAlarmThreshold>)))]
public readonly string? TemperatureThresholdId;
[ViewVariables]
public AtmosAlarmThreshold? TemperatureThreshold;
[ViewVariables]
public AtmosAlarmThreshold? TemperatureThreshold;
[DataField("pressureThreshold", customTypeSerializer: (typeof(PrototypeIdSerializer<AtmosAlarmThreshold>)))]
public readonly string? PressureThresholdId;
[DataField("pressureThreshold", customTypeSerializer: (typeof(PrototypeIdSerializer<AtmosAlarmThreshold>)))]
public readonly string? PressureThresholdId;
[ViewVariables]
public AtmosAlarmThreshold? PressureThreshold;
[ViewVariables]
public AtmosAlarmThreshold? PressureThreshold;
// monitor fire - much different from temperature
// since there's events for fire, setting this to true
// will make the atmos monitor act like a smoke detector,
// immediately signalling danger if there's a fire
[DataField("monitorFire")]
public bool MonitorFire = false;
// monitor fire - much different from temperature
// since there's events for fire, setting this to true
// will make the atmos monitor act like a smoke detector,
// immediately signalling danger if there's a fire
[DataField("monitorFire")]
public bool MonitorFire = false;
// really messy but this is parsed at runtime after
// prototypes are initialized, there's no
// way without implementing a new
// type serializer
[DataField("gasThresholds")]
public Dictionary<Gas, string>? GasThresholdIds;
// really messy but this is parsed at runtime after
// prototypes are initialized, there's no
// way without implementing a new
// type serializer
[DataField("gasThresholds")]
public Dictionary<Gas, string>? GasThresholdIds;
[ViewVariables]
public Dictionary<Gas, AtmosAlarmThreshold>? GasThresholds;
[ViewVariables]
public Dictionary<Gas, AtmosAlarmThreshold>? GasThresholds;
// Stores a reference to the gas on the tile this is on.
[ViewVariables]
public GasMixture? TileGas;
// Stores a reference to the gas on the tile this is on.
[ViewVariables]
public GasMixture? TileGas;
// Stores the last alarm state of this alarm.
[ViewVariables]
public AtmosMonitorAlarmType LastAlarmState = AtmosMonitorAlarmType.Normal;
// Stores the last alarm state of this alarm.
[ViewVariables]
public AtmosMonitorAlarmType LastAlarmState = AtmosMonitorAlarmType.Normal;
[ViewVariables] public HashSet<AtmosMonitorThresholdType> TrippedThresholds = new();
[ViewVariables] public HashSet<AtmosMonitorThresholdType> TrippedThresholds = new();
/// <summary>
/// Registered devices in this atmos monitor. Alerts will be sent directly
/// to these devices.
/// </summary>
[ViewVariables] public HashSet<string> RegisteredDevices = new();
}
/// <summary>
/// Registered devices in this atmos monitor. Alerts will be sent directly
/// to these devices.
/// </summary>
[ViewVariables] public HashSet<string> RegisteredDevices = new();
}

View File

@@ -1,7 +1,6 @@
namespace Content.Server.Atmos.Monitor.Components
namespace Content.Server.Atmos.Monitor.Components;
[RegisterComponent]
public sealed class FireAlarmComponent : Component
{
[RegisterComponent]
public sealed class FireAlarmComponent : Component
{
}
}
}