Fixes reset propagation for atmospheric alarm receivers, adds CVar for fire alarm all access (#11020)

* adds a check for if a firelock is powered before auto-opening

* fixes issue where resets would not propagate properly

* adds cvar bound for fire alarm access (defaults to all access)
This commit is contained in:
Flipp Syder
2022-09-05 18:15:50 -07:00
committed by GitHub
parent 8114d9d614
commit 8cbcf2d640
4 changed files with 37 additions and 15 deletions

View File

@@ -241,34 +241,36 @@ public sealed class AtmosAlarmableSystem : EntitySystem
/// </summary>
/// <param name="uid"></param>
/// <param name="alarmable"></param>
public void Reset(EntityUid uid, AtmosAlarmableComponent? alarmable = null)
public void Reset(EntityUid uid, AtmosAlarmableComponent? alarmable = null, TagComponent? tags = null)
{
if (!Resolve(uid, ref alarmable))
if (!Resolve(uid, ref alarmable, ref tags) || alarmable.LastAlarmState == AtmosAlarmType.Normal)
{
return;
}
TryUpdateAlert(uid, AtmosAlarmType.Normal, alarmable, false);
alarmable.NetworkAlarmStates.Clear();
TryUpdateAlert(uid, AtmosAlarmType.Normal, alarmable);
if (!alarmable.ReceiveOnly)
{
var payload = new NetworkPayload
{
[DeviceNetworkConstants.Command] = ResetAll,
[AlertSource] = tags.Tags
};
_deviceNet.QueuePacket(uid, null, payload);
}
}
public void ResetAllOnNetwork(EntityUid uid, AtmosAlarmableComponent? alarmable = null, TagComponent? tags = null)
public void ResetAllOnNetwork(EntityUid uid, AtmosAlarmableComponent? alarmable = null)
{
if (!Resolve(uid, ref alarmable, ref tags) || alarmable.ReceiveOnly)
if (!Resolve(uid, ref alarmable) || alarmable.ReceiveOnly)
{
return;
}
Reset(uid, alarmable);
var payload = new NetworkPayload
{
[DeviceNetworkConstants.Command] = ResetAll,
[AlertSource] = tags.Tags
};
_deviceNet.QueuePacket(uid, null, payload);
}
/// <summary>