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:
@@ -241,27 +241,18 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="uid"></param>
|
/// <param name="uid"></param>
|
||||||
/// <param name="alarmable"></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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TryUpdateAlert(uid, AtmosAlarmType.Normal, alarmable, false);
|
|
||||||
|
|
||||||
alarmable.NetworkAlarmStates.Clear();
|
alarmable.NetworkAlarmStates.Clear();
|
||||||
}
|
TryUpdateAlert(uid, AtmosAlarmType.Normal, alarmable);
|
||||||
|
|
||||||
public void ResetAllOnNetwork(EntityUid uid, AtmosAlarmableComponent? alarmable = null, TagComponent? tags = null)
|
if (!alarmable.ReceiveOnly)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref alarmable, ref tags) || alarmable.ReceiveOnly)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Reset(uid, alarmable);
|
|
||||||
|
|
||||||
var payload = new NetworkPayload
|
var payload = new NetworkPayload
|
||||||
{
|
{
|
||||||
[DeviceNetworkConstants.Command] = ResetAll,
|
[DeviceNetworkConstants.Command] = ResetAll,
|
||||||
@@ -270,6 +261,17 @@ public sealed class AtmosAlarmableSystem : EntitySystem
|
|||||||
|
|
||||||
_deviceNet.QueuePacket(uid, null, payload);
|
_deviceNet.QueuePacket(uid, null, payload);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetAllOnNetwork(EntityUid uid, AtmosAlarmableComponent? alarmable = null)
|
||||||
|
{
|
||||||
|
if (!Resolve(uid, ref alarmable) || alarmable.ReceiveOnly)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Reset(uid, alarmable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to get the highest possible alert stored in this alarm.
|
/// Tries to get the highest possible alert stored in this alarm.
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ using Content.Server.Atmos.Monitor.Components;
|
|||||||
using Content.Server.DeviceNetwork.Systems;
|
using Content.Server.DeviceNetwork.Systems;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.Power.EntitySystems;
|
using Content.Server.Power.EntitySystems;
|
||||||
|
using Content.Shared.Access.Systems;
|
||||||
using Content.Shared.AlertLevel;
|
using Content.Shared.AlertLevel;
|
||||||
using Content.Shared.Atmos.Monitor;
|
using Content.Shared.Atmos.Monitor;
|
||||||
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.DeviceNetwork;
|
using Content.Shared.DeviceNetwork;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Emag.Systems;
|
using Content.Shared.Emag.Systems;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Configuration;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Monitor.Systems;
|
namespace Content.Server.Atmos.Monitor.Systems;
|
||||||
|
|
||||||
@@ -17,6 +20,8 @@ public sealed class FireAlarmSystem : EntitySystem
|
|||||||
[Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNet = default!;
|
[Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNet = default!;
|
||||||
[Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!;
|
[Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!;
|
||||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||||
|
[Dependency] private readonly AccessReaderSystem _access = default!;
|
||||||
|
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -36,6 +41,9 @@ public sealed class FireAlarmSystem : EntitySystem
|
|||||||
if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target))
|
if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!_configManager.GetCVar(CCVars.FireAlarmAllAccess) && !_access.IsAllowed(args.User, args.Target))
|
||||||
|
return;
|
||||||
|
|
||||||
if (this.IsPowered(uid, EntityManager))
|
if (this.IsPowered(uid, EntityManager))
|
||||||
{
|
{
|
||||||
if (!_atmosAlarmable.TryGetHighestAlert(uid, out var alarm))
|
if (!_atmosAlarmable.TryGetHighestAlert(uid, out var alarm))
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Server.Doors.Systems
|
|||||||
|
|
||||||
private void OnBeforeDoorOpened(EntityUid uid, FirelockComponent component, BeforeDoorOpenedEvent args)
|
private void OnBeforeDoorOpened(EntityUid uid, FirelockComponent component, BeforeDoorOpenedEvent args)
|
||||||
{
|
{
|
||||||
if (component.IsHoldingFire() || component.IsHoldingPressure())
|
if (!this.IsPowered(uid, EntityManager) || component.IsHoldingFire() || component.IsHoldingPressure())
|
||||||
args.Cancel();
|
args.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1185,6 +1185,18 @@ namespace Content.Shared.CCVar
|
|||||||
public static readonly CVarDef<float> GhostRoleTime =
|
public static readonly CVarDef<float> GhostRoleTime =
|
||||||
CVarDef.Create("ghost.role_time", 3f, CVar.REPLICATED);
|
CVarDef.Create("ghost.role_time", 3f, CVar.REPLICATED);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fire alarm
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If fire alarms should have all access, or if activating/resetting these
|
||||||
|
/// should be restricted to what is dictated on a player's access card.
|
||||||
|
/// Defaults to true.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<bool> FireAlarmAllAccess =
|
||||||
|
CVarDef.Create("firealarm.allaccess", true, CVar.SERVERONLY);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PLAYTIME
|
* PLAYTIME
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user