resetall now affects atmos monitor alerts

This commit is contained in:
vulppine
2022-08-22 09:19:02 -07:00
parent 2d22c37210
commit 786bddff0a
2 changed files with 3 additions and 60 deletions

View File

@@ -105,21 +105,6 @@ namespace Content.Server.Atmos.Monitor.Systems
} }
} }
/// <summary>
/// Reset a single sensor's state.
/// </summary>
/// <param name="uid"></param>
/// <param name="address"></param>
private void ResetSensor(EntityUid uid, string address)
{
var payload = new NetworkPayload
{
[DeviceNetworkConstants.Command] = AtmosMonitorSystem.AtmosMonitorAlarmResetCmd,
};
_deviceNet.QueuePacket(uid, address, payload);
}
private void SetThreshold(EntityUid uid, string address, AtmosMonitorThresholdType type, private void SetThreshold(EntityUid uid, string address, AtmosMonitorThresholdType type,
AtmosAlarmThreshold threshold, Gas? gas = null) AtmosAlarmThreshold threshold, Gas? gas = null)
{ {

View File

@@ -26,40 +26,14 @@ namespace Content.Server.Atmos.Monitor.Systems
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly AtmosDeviceSystem _atmosDeviceSystem = default!; [Dependency] private readonly AtmosDeviceSystem _atmosDeviceSystem = default!;
[Dependency] private readonly DeviceNetworkSystem _deviceNetSystem = default!; [Dependency] private readonly DeviceNetworkSystem _deviceNetSystem = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
// Commands // Commands
/// <summary>
/// Command to alarm the network that something has happened.
/// </summary>
public const string AtmosMonitorAlarmCmd = "atmos_monitor_alarm_update";
/// <summary>
/// Command to sync this monitor's alarm state with the rest of the network.
/// </summary>
public const string AtmosMonitorAlarmSyncCmd = "atmos_monitor_alarm_sync";
/// <summary>
/// Command to reset a single alarm.
/// </summary>
public const string AtmosMonitorAlarmResetCmd = "atmos_monitor_alarm_reset";
/// <summary>
/// Command to reset all alarms on a network.
/// </summary>
public const string AtmosMonitorAlarmResetAllCmd = "atmos_monitor_alarm_reset_all";
public const string AtmosMonitorSetThresholdCmd = "atmos_monitor_set_threshold"; public const string AtmosMonitorSetThresholdCmd = "atmos_monitor_set_threshold";
// Packet data // Packet data
/// <summary>
/// Data response that contains the source of an atmos alarm.
/// </summary>
public const string AtmosMonitorAlarmSrc = "atmos_monitor_alarm_source";
public const string AtmosMonitorThresholdData = "atmos_monitor_threshold_data"; public const string AtmosMonitorThresholdData = "atmos_monitor_threshold_data";
public const string AtmosMonitorThresholdDataType = "atmos_monitor_threshold_type"; public const string AtmosMonitorThresholdDataType = "atmos_monitor_threshold_type";
@@ -124,7 +98,7 @@ namespace Content.Server.Atmos.Monitor.Systems
case AtmosDeviceNetworkSystem.RegisterDevice: case AtmosDeviceNetworkSystem.RegisterDevice:
component.RegisteredDevices.Add(args.SenderAddress); component.RegisteredDevices.Add(args.SenderAddress);
break; break;
case AtmosMonitorAlarmResetCmd: case AtmosAlarmableSystem.ResetAll:
Reset(uid); Reset(uid);
// Don't clear alarm states here. // Don't clear alarm states here.
break; break;
@@ -307,17 +281,9 @@ namespace Content.Server.Atmos.Monitor.Systems
/// <summary> /// <summary>
/// Resets a single monitor's alarm. /// Resets a single monitor's alarm.
/// </summary> /// </summary>
public void Reset(EntityUid uid) => private void Reset(EntityUid uid)
Alert(uid, AtmosMonitorAlarmType.Normal);
/// <summary>
/// Resets a network's alarms, using this monitor as a source.
/// </summary>
/// <remarks>
/// The resulting packet will have this monitor set as the source, using its prototype ID if it has one - otherwise just sending an empty string.
/// </remarks>
public void ResetAll(EntityUid uid, AtmosMonitorComponent? monitor = null)
{ {
Alert(uid, AtmosMonitorAlarmType.Normal);
} }
/// <summary> /// <summary>
@@ -342,14 +308,6 @@ namespace Content.Server.Atmos.Monitor.Systems
return; return;
} }
/*
string source = string.Empty;
if (alarms == null) alarms = new List<AtmosMonitorThresholdType>();
var prototype = Prototype(monitor.Owner);
if (prototype != null) source = prototype.ID;
*/
var payload = new NetworkPayload var payload = new NetworkPayload
{ {
[DeviceNetworkConstants.Command] = AtmosAlarmableSystem.AlertCmd, [DeviceNetworkConstants.Command] = AtmosAlarmableSystem.AlertCmd,