air alarm signal ports and other stuff (#18642)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-08-21 22:18:30 +01:00
committed by GitHub
parent 2cbe8609a3
commit e837f2fd85
12 changed files with 181 additions and 59 deletions

View File

@@ -1,7 +1,10 @@
using Content.Server.DeviceLinking.Components;
using Content.Shared.Atmos.Monitor; using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Monitor.Components; using Content.Shared.Atmos.Monitor.Components;
using Content.Shared.Atmos.Piping.Unary.Components; using Content.Shared.Atmos.Piping.Unary.Components;
using Content.Shared.DeviceLinking;
using Robust.Shared.Network; using Robust.Shared.Network;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Atmos.Monitor.Components; namespace Content.Server.Atmos.Monitor.Components;
@@ -24,4 +27,28 @@ public sealed class AirAlarmComponent : Component
public HashSet<NetUserId> ActivePlayers = new(); public HashSet<NetUserId> ActivePlayers = new();
public bool CanSync = true; public bool CanSync = true;
/// <summary>
/// Previous alarm state for use with output ports.
/// </summary>
[DataField("state")]
public AtmosAlarmType State = AtmosAlarmType.Normal;
/// <summary>
/// The port that gets set to high while the alarm is in the danger state, and low when not.
/// </summary>
[DataField("dangerPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string DangerPort = "AirDanger";
/// <summary>
/// The port that gets set to high while the alarm is in the warning state, and low when not.
/// </summary>
[DataField("warningPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string WarningPort = "AirWarning";
/// <summary>
/// The port that gets set to high while the alarm is in the normal state, and low when not.
/// </summary>
[DataField("normalPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string NormalPort = "AirNormal";
} }

View File

@@ -1,6 +1,7 @@
using System.Linq; using System.Linq;
using Content.Server.Atmos.Monitor.Components; using Content.Server.Atmos.Monitor.Components;
using Content.Server.Atmos.Piping.Components; using Content.Server.Atmos.Piping.Components;
using Content.Server.DeviceLinking.Systems;
using Content.Server.DeviceNetwork; using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components; using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Systems; using Content.Server.DeviceNetwork.Systems;
@@ -13,6 +14,7 @@ using Content.Shared.Atmos;
using Content.Shared.Atmos.Monitor; using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Monitor.Components; using Content.Shared.Atmos.Monitor.Components;
using Content.Shared.Atmos.Piping.Unary.Components; using Content.Shared.Atmos.Piping.Unary.Components;
using Content.Shared.DeviceLinking;
using Content.Shared.DeviceNetwork; using Content.Shared.DeviceNetwork;
using Content.Shared.DeviceNetwork.Systems; using Content.Shared.DeviceNetwork.Systems;
using Content.Shared.Interaction; using Content.Shared.Interaction;
@@ -32,14 +34,14 @@ namespace Content.Server.Atmos.Monitor.Systems;
// response data in its data key. // response data in its data key.
public sealed class AirAlarmSystem : EntitySystem public sealed class AirAlarmSystem : EntitySystem
{ {
[Dependency] private readonly DeviceNetworkSystem _deviceNet = default!; [Dependency] private readonly AccessReaderSystem _access = default!;
[Dependency] private readonly DeviceListSystem _deviceListSystem = default!;
[Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNetSystem = default!;
[Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!; [Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly AtmosDeviceNetworkSystem _atmosDevNet = default!;
[Dependency] private readonly AccessReaderSystem _accessSystem = default!; [Dependency] private readonly DeviceNetworkSystem _deviceNet = default!;
[Dependency] private readonly DeviceLinkSystem _deviceLink = default!;
[Dependency] private readonly DeviceListSystem _deviceList = default!;
[Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly UserInterfaceSystem _ui = default!;
#region Device Network API #region Device Network API
@@ -57,8 +59,8 @@ public sealed class AirAlarmSystem : EntitySystem
/// <param name="data">The data to send to the device.</param> /// <param name="data">The data to send to the device.</param>
public void SetData(EntityUid uid, string address, IAtmosDeviceData data) public void SetData(EntityUid uid, string address, IAtmosDeviceData data)
{ {
_atmosDevNetSystem.SetDeviceState(uid, address, data); _atmosDevNet.SetDeviceState(uid, address, data);
_atmosDevNetSystem.Sync(uid, address); _atmosDevNet.Sync(uid, address);
} }
/// <summary> /// <summary>
@@ -66,7 +68,7 @@ public sealed class AirAlarmSystem : EntitySystem
/// </summary> /// </summary>
private void SyncAllDevices(EntityUid uid) private void SyncAllDevices(EntityUid uid)
{ {
_atmosDevNetSystem.Sync(uid, null); _atmosDevNet.Sync(uid, null);
} }
/// <summary> /// <summary>
@@ -75,7 +77,7 @@ public sealed class AirAlarmSystem : EntitySystem
/// <param name="address">The address of the device.</param> /// <param name="address">The address of the device.</param>
private void SyncDevice(EntityUid uid, string address) private void SyncDevice(EntityUid uid, string address)
{ {
_atmosDevNetSystem.Sync(uid, address); _atmosDevNet.Sync(uid, address);
} }
/// <summary> /// <summary>
@@ -85,8 +87,8 @@ public sealed class AirAlarmSystem : EntitySystem
/// <param name="uid"></param> /// <param name="uid"></param>
private void SyncRegisterAllDevices(EntityUid uid) private void SyncRegisterAllDevices(EntityUid uid)
{ {
_atmosDevNetSystem.Register(uid, null); _atmosDevNet.Register(uid, null);
_atmosDevNetSystem.Sync(uid, null); _atmosDevNet.Sync(uid, null);
} }
/// <summary> /// <summary>
@@ -133,8 +135,7 @@ public sealed class AirAlarmSystem : EntitySystem
/// <param name="mode">The mode to sync with the rest of the network.</param> /// <param name="mode">The mode to sync with the rest of the network.</param>
private void SyncMode(EntityUid uid, AirAlarmMode mode) private void SyncMode(EntityUid uid, AirAlarmMode mode)
{ {
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor) if (TryComp<AtmosMonitorComponent>(uid, out var monitor) && !monitor.NetEnabled)
&& !monitor.NetEnabled)
return; return;
var payload = new NetworkPayload var payload = new NetworkPayload
@@ -165,6 +166,8 @@ public sealed class AirAlarmSystem : EntitySystem
SubscribeLocalEvent<AirAlarmComponent, AirAlarmTabSetMessage>(OnTabChange); SubscribeLocalEvent<AirAlarmComponent, AirAlarmTabSetMessage>(OnTabChange);
SubscribeLocalEvent<AirAlarmComponent, DeviceListUpdateEvent>(OnDeviceListUpdate); SubscribeLocalEvent<AirAlarmComponent, DeviceListUpdateEvent>(OnDeviceListUpdate);
SubscribeLocalEvent<AirAlarmComponent, BoundUIClosedEvent>(OnClose); SubscribeLocalEvent<AirAlarmComponent, BoundUIClosedEvent>(OnClose);
SubscribeLocalEvent<AirAlarmComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<AirAlarmComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<AirAlarmComponent, ComponentShutdown>(OnShutdown); SubscribeLocalEvent<AirAlarmComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<AirAlarmComponent, ActivateInWorldEvent>(OnActivate); SubscribeLocalEvent<AirAlarmComponent, ActivateInWorldEvent>(OnActivate);
} }
@@ -179,7 +182,7 @@ public sealed class AirAlarmSystem : EntitySystem
continue; continue;
} }
_atmosDevNetSystem.Deregister(uid, deviceNet.Address); _atmosDevNet.Deregister(uid, deviceNet.Address);
} }
component.ScrubberData.Clear(); component.ScrubberData.Clear();
@@ -220,6 +223,18 @@ public sealed class AirAlarmSystem : EntitySystem
RemoveActiveInterface(uid); RemoveActiveInterface(uid);
} }
private void OnInit(EntityUid uid, AirAlarmComponent comp, ComponentInit args)
{
_deviceLink.EnsureSourcePorts(uid, comp.DangerPort, comp.WarningPort, comp.NormalPort);
}
private void OnMapInit(EntityUid uid, AirAlarmComponent comp, MapInitEvent args)
{
// for mapped linked air alarms, start with high so when it changes for the first time it goes from high to low
// without this the output would suddenly get sent a low signal after nothing which is bad
_deviceLink.SendSignal(uid, GetPort(comp), true);
}
private void OnShutdown(EntityUid uid, AirAlarmComponent component, ComponentShutdown args) private void OnShutdown(EntityUid uid, AirAlarmComponent component, ComponentShutdown args)
{ {
_activeUserInterfaces.Remove(uid); _activeUserInterfaces.Remove(uid);
@@ -227,9 +242,6 @@ public sealed class AirAlarmSystem : EntitySystem
private void OnActivate(EntityUid uid, AirAlarmComponent component, ActivateInWorldEvent args) private void OnActivate(EntityUid uid, AirAlarmComponent component, ActivateInWorldEvent args)
{ {
if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target))
return;
if (!TryComp<ActorComponent>(args.User, out var actor)) if (!TryComp<ActorComponent>(args.User, out var actor))
return; return;
@@ -242,9 +254,9 @@ public sealed class AirAlarmSystem : EntitySystem
if (!this.IsPowered(uid, EntityManager)) if (!this.IsPowered(uid, EntityManager))
return; return;
var ui = _uiSystem.GetUiOrNull(uid, SharedAirAlarmInterfaceKey.Key); var ui = _ui.GetUiOrNull(uid, SharedAirAlarmInterfaceKey.Key);
if (ui != null) if (ui != null)
_uiSystem.OpenUi(ui, actor.PlayerSession); _ui.OpenUi(ui, actor.PlayerSession);
component.ActivePlayers.Add(actor.PlayerSession.UserId); component.ActivePlayers.Add(actor.PlayerSession.UserId);
AddActiveInterface(uid); AddActiveInterface(uid);
SyncAllDevices(uid); SyncAllDevices(uid);
@@ -268,12 +280,20 @@ public sealed class AirAlarmSystem : EntitySystem
private void OnUpdateAlarmMode(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAlarmModeMessage args) private void OnUpdateAlarmMode(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAlarmModeMessage args)
{ {
var addr = string.Empty;
if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)) addr = netConn.Address;
if (AccessCheck(uid, args.Session.AttachedEntity, component)) if (AccessCheck(uid, args.Session.AttachedEntity, component))
{
var addr = string.Empty;
if (TryComp<DeviceNetworkComponent>(uid, out var netConn))
{
addr = netConn.Address;
}
SetMode(uid, addr, args.Mode, false); SetMode(uid, addr, args.Mode, false);
}
else else
{
UpdateUI(uid, component); UpdateUI(uid, component);
}
} }
private void OnUpdateAutoMode(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAutoModeMessage args) private void OnUpdateAutoMode(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAutoModeMessage args)
@@ -293,7 +313,7 @@ public sealed class AirAlarmSystem : EntitySystem
private void OnUpdateDeviceData(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateDeviceDataMessage args) private void OnUpdateDeviceData(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateDeviceDataMessage args)
{ {
if (AccessCheck(uid, args.Session.AttachedEntity, component) if (AccessCheck(uid, args.Session.AttachedEntity, component)
&& _deviceListSystem.ExistsInDeviceList(uid, args.Address)) && _deviceList.ExistsInDeviceList(uid, args.Address))
{ {
SetDeviceData(uid, args.Address, args.Data); SetDeviceData(uid, args.Address, args.Data);
} }
@@ -334,10 +354,14 @@ public sealed class AirAlarmSystem : EntitySystem
if (!Resolve(uid, ref component)) if (!Resolve(uid, ref component))
return false; return false;
if (!EntityManager.TryGetComponent(uid, out AccessReaderComponent? reader) || user == null) // if it has no access reader behave as if the user has AA
if (!TryComp<AccessReaderComponent>(uid, out var reader))
return true;
if (user == null)
return false; return false;
if (!_accessSystem.IsAllowed(user.Value, reader)) if (!_access.IsAllowed(user.Value, reader))
{ {
_popup.PopupEntity(Loc.GetString("air-alarm-ui-access-denied"), user.Value, user.Value); _popup.PopupEntity(Loc.GetString("air-alarm-ui-access-denied"), user.Value, user.Value);
return false; return false;
@@ -354,8 +378,10 @@ public sealed class AirAlarmSystem : EntitySystem
} }
var addr = string.Empty; var addr = string.Empty;
if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)) if (TryComp<DeviceNetworkComponent>(uid, out var netConn))
{
addr = netConn.Address; addr = netConn.Address;
}
if (component.AutoMode) if (component.AutoMode)
{ {
@@ -369,9 +395,32 @@ public sealed class AirAlarmSystem : EntitySystem
} }
} }
if (component.State != args.AlarmType)
{
TryComp<DeviceLinkSourceComponent>(uid, out var source);
// send low to old state's port
_deviceLink.SendSignal(uid, GetPort(component), false, source);
// send high to new state's port, along with updating the cached state
component.State = args.AlarmType;
_deviceLink.SendSignal(uid, GetPort(component), true, source);
}
UpdateUI(uid, component); UpdateUI(uid, component);
} }
private string GetPort(AirAlarmComponent comp)
{
if (comp.State == AtmosAlarmType.Danger)
return comp.DangerPort;
if (comp.State == AtmosAlarmType.Warning)
return comp.WarningPort;
return comp.NormalPort;
}
#endregion #endregion
#region Air Alarm Settings #region Air Alarm Settings
@@ -517,7 +566,7 @@ public sealed class AirAlarmSystem : EntitySystem
/// </summary> /// </summary>
private void ForceCloseAllInterfaces(EntityUid uid) private void ForceCloseAllInterfaces(EntityUid uid)
{ {
_uiSystem.TryCloseAll(uid, SharedAirAlarmInterfaceKey.Key); _ui.TryCloseAll(uid, SharedAirAlarmInterfaceKey.Key);
} }
private void OnAtmosUpdate(EntityUid uid, AirAlarmComponent alarm, AtmosDeviceUpdateEvent args) private void OnAtmosUpdate(EntityUid uid, AirAlarmComponent alarm, AtmosDeviceUpdateEvent args)
@@ -585,7 +634,7 @@ public sealed class AirAlarmSystem : EntitySystem
highestAlarm = AtmosAlarmType.Normal; highestAlarm = AtmosAlarmType.Normal;
} }
_uiSystem.TrySetUiState( _ui.TrySetUiState(
uid, uid,
SharedAirAlarmInterfaceKey.Key, SharedAirAlarmInterfaceKey.Key,
new AirAlarmUIState(devNet.Address, deviceCount, pressure, temperature, dataToSend, alarm.CurrentMode, alarm.CurrentTab, highestAlarm.Value, alarm.AutoMode)); new AirAlarmUIState(devNet.Address, deviceCount, pressure, temperature, dataToSend, alarm.CurrentMode, alarm.CurrentTab, highestAlarm.Value, alarm.AutoMode));

View File

@@ -1,3 +1,4 @@
using Content.Server.DeviceLinking.Components;
using Content.Server.DeviceLinking.Events; using Content.Server.DeviceLinking.Events;
using Content.Server.DeviceNetwork; using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components; using Content.Server.DeviceNetwork.Components;
@@ -95,11 +96,25 @@ public sealed class DeviceLinkSystem : SharedDeviceLinkSystem
} }
} }
_deviceNetworkSystem.QueuePacket(uid, sinkNetworkComponent.Address, payload, sinkNetworkComponent.ReceiveFrequency); // force using wireless network so things like atmos devices are able to send signals
var network = (int) DeviceNetworkComponent.DeviceNetIdDefaults.Wireless;
_deviceNetworkSystem.QueuePacket(uid, sinkNetworkComponent.Address, payload, sinkNetworkComponent.ReceiveFrequency, network);
} }
} }
} }
/// <summary>
/// Helper function that invokes a port with a high/low binary logic signal.
/// </summary>
public void SendSignal(EntityUid uid, string port, bool signal, DeviceLinkSourceComponent? comp = null)
{
var data = new NetworkPayload
{
[DeviceNetworkConstants.LogicState] = signal ? SignalState.High : SignalState.Low
};
InvokePort(uid, port, data, comp);
}
/// <summary> /// <summary>
/// Checks if the payload has a port defined and if the port is present on the sink. /// Checks if the payload has a port defined and if the port is present on the sink.
/// Raises a <see cref="SignalReceivedEvent"/> containing the payload when the check passes /// Raises a <see cref="SignalReceivedEvent"/> containing the payload when the check passes

View File

@@ -140,12 +140,7 @@ public sealed class LogicGateSystem : EntitySystem
{ {
comp.LastOutput = output; comp.LastOutput = output;
var data = new NetworkPayload _deviceLink.SendSignal(uid, comp.OutputPort, output);
{
[DeviceNetworkConstants.LogicState] = output ? SignalState.High : SignalState.Low
};
_deviceLink.InvokePort(uid, comp.OutputPort, data);
} }
} }
} }

View File

@@ -30,15 +30,11 @@ public sealed class SignalSwitchSystem : EntitySystem
comp.State = !comp.State; comp.State = !comp.State;
_deviceLink.InvokePort(uid, comp.State ? comp.OnPort : comp.OffPort); _deviceLink.InvokePort(uid, comp.State ? comp.OnPort : comp.OffPort);
var data = new NetworkPayload
{
[DeviceNetworkConstants.LogicState] = comp.State ? SignalState.High : SignalState.Low
};
// only send status if it's a toggle switch and not a button // only send status if it's a toggle switch and not a button
if (comp.OnPort != comp.OffPort) if (comp.OnPort != comp.OffPort)
{ {
_deviceLink.InvokePort(uid, comp.StatusPort, data); _deviceLink.SendSignal(uid, comp.StatusPort, comp.State);
} }
_audio.PlayPvs(comp.ClickSound, uid, AudioParams.Default.WithVariation(0.125f).WithVolume(8f)); _audio.PlayPvs(comp.ClickSound, uid, AudioParams.Default.WithVariation(0.125f).WithVolume(8f));

View File

@@ -66,7 +66,7 @@ namespace Content.Server.DeviceNetwork.Systems
/// <param name="frequency">The frequency to send on</param> /// <param name="frequency">The frequency to send on</param>
/// <param name="data">The data to be sent</param> /// <param name="data">The data to be sent</param>
/// <returns>Returns true when the packet was successfully enqueued.</returns> /// <returns>Returns true when the packet was successfully enqueued.</returns>
public bool QueuePacket(EntityUid uid, string? address, NetworkPayload data, uint? frequency = null, DeviceNetworkComponent? device = null) public bool QueuePacket(EntityUid uid, string? address, NetworkPayload data, uint? frequency = null, int? network = null, DeviceNetworkComponent? device = null)
{ {
if (!Resolve(uid, ref device, false)) if (!Resolve(uid, ref device, false))
return false; return false;
@@ -79,7 +79,9 @@ namespace Content.Server.DeviceNetwork.Systems
if (frequency == null) if (frequency == null)
return false; return false;
_nextQueue.Enqueue(new DeviceNetworkPacketEvent(device.DeviceNetId, address, frequency.Value, device.Address, uid, data)); network ??= device.DeviceNetId;
_nextQueue.Enqueue(new DeviceNetworkPacketEvent(network.Value, address, frequency.Value, device.Address, uid, data));
return true; return true;
} }

View File

@@ -17,7 +17,7 @@ namespace Content.Server.DeviceNetwork.Systems
/// </summary> /// </summary>
private void OnBeforePacketSent(EntityUid uid, WiredNetworkComponent component, BeforePacketSentEvent args) private void OnBeforePacketSent(EntityUid uid, WiredNetworkComponent component, BeforePacketSentEvent args)
{ {
if (EntityManager.GetComponent<TransformComponent>(uid).GridUid != args.SenderTransform.GridUid) if (Transform(uid).GridUid != args.SenderTransform.GridUid)
{ {
args.Cancel(); args.Cancel();
} }

View File

@@ -20,8 +20,11 @@ namespace Content.Server.DeviceNetwork.Systems
var ownPosition = args.SenderPosition; var ownPosition = args.SenderPosition;
var xform = Transform(uid); var xform = Transform(uid);
// not a wireless to wireless connection, just let it happen
if (!TryComp<WirelessNetworkComponent>(args.Sender, out var sendingComponent))
return;
if (xform.MapID != args.SenderTransform.MapID if (xform.MapID != args.SenderTransform.MapID
|| !TryComp<WirelessNetworkComponent>(args.Sender, out var sendingComponent)
|| (ownPosition - xform.WorldPosition).Length() > sendingComponent.Range) || (ownPosition - xform.WorldPosition).Length() > sendingComponent.Range)
{ {
args.Cancel(); args.Cancel();

View File

@@ -111,7 +111,7 @@ public sealed class MailingUnitSystem : EntitySystem
[NetTarget] = component.Target [NetTarget] = component.Target
}; };
_deviceNetworkSystem.QueuePacket(uid, null, payload, null, device); _deviceNetworkSystem.QueuePacket(uid, null, payload, null, null, device);
} }
/// <summary> /// <summary>
@@ -129,7 +129,7 @@ public sealed class MailingUnitSystem : EntitySystem
}; };
component.TargetList.Clear(); component.TargetList.Clear();
_deviceNetworkSystem.QueuePacket(uid, null, payload, null, device); _deviceNetworkSystem.QueuePacket(uid, null, payload, null, null, device);
} }
/// <summary> /// <summary>

View File

@@ -8,7 +8,7 @@ signal-port-name-off-transmitter = Off
signal-port-description-off-transmitter = This port is invoked whenever the transmitter is turned off. signal-port-description-off-transmitter = This port is invoked whenever the transmitter is turned off.
signal-port-name-status-transmitter = Status signal-port-name-status-transmitter = Status
signal-port-description-logic-output = This port is invoked with HIGH or LOW depending on the transmitter status. signal-port-description-status-transmitter = This port is invoked with HIGH or LOW depending on the transmitter status.
signal-port-name-left = Left signal-port-name-left = Left
signal-port-description-left = This port is invoked whenever the lever is moved to the leftmost position. signal-port-description-left = This port is invoked whenever the lever is moved to the leftmost position.
@@ -36,3 +36,12 @@ signal-port-description-logic-output-high = This port is invoked whenever the in
signal-port-name-logic-output-low = Low Output signal-port-name-logic-output-low = Low Output
signal-port-description-logic-output-low = This port is invoked whenever the input has a falling edge. signal-port-description-logic-output-low = This port is invoked whenever the input has a falling edge.
signal-port-name-air-danger = Danger
signal-port-description-air-danger = This port is invoked with HIGH when in danger mode and LOW when not.
signal-port-name-air-warning = Warning
signal-port-description-air-warning = This port is invoked with HIGH when in warning mode and LOW when not.
signal-port-name-air-normal = Normal
signal-port-description-air-normal = This port is invoked with HIGH when in normal mode and LOW when not.

View File

@@ -96,3 +96,21 @@
name: signal-port-name-logic-output-low name: signal-port-name-logic-output-low
description: signal-port-description-logic-output-low description: signal-port-description-logic-output-low
defaultLinks: [ Off, Close ] defaultLinks: [ Off, Close ]
- type: sourcePort
id: AirDanger
name: signal-port-name-air-danger
description: signal-port-description-air-danger
defaultLinks: [ DoorBolt ]
- type: sourcePort
id: AirWarning
name: signal-port-name-air-warning
description: signal-port-description-air-warning
defaultLinks: [ DoorBolt ]
- type: sourcePort
id: AirNormal
name: signal-port-name-air-normal
description: signal-port-description-air-normal
defaultLinks: [ DoorBolt ]

View File

@@ -2,6 +2,10 @@
id: AirAlarm id: AirAlarm
name: air alarm name: air alarm
description: An air alarm. Alarms... air? description: An air alarm. Alarms... air?
placement:
mode: SnapgridCenter
snap:
- Wallmount
components: components:
- type: WallMount - type: WallMount
- type: ApcPowerReceiver - type: ApcPowerReceiver
@@ -16,14 +20,22 @@
prefix: device-address-prefix-air-alarm prefix: device-address-prefix-air-alarm
sendBroadcastAttemptEvent: true sendBroadcastAttemptEvent: true
- type: WiredNetworkConnection - type: WiredNetworkConnection
# for output status ports
- type: WirelessNetworkConnection
range: 200
- type: DeviceList - type: DeviceList
- type: DeviceNetworkRequiresPower - type: DeviceNetworkRequiresPower
- type: DeviceLinkSource
ports:
- AirDanger
- AirWarning
- AirNormal
- type: AtmosAlarmable - type: AtmosAlarmable
syncWith: syncWith:
- AirAlarm - AirAlarm
- AirSensor - AirSensor
- GasVent - GasVent
- GasScrubber - GasScrubber
- type: AtmosAlarmableVisuals - type: AtmosAlarmableVisuals
layerMap: "airAlarmBase" layerMap: "airAlarmBase"
alarmStates: alarmStates:
@@ -85,15 +97,15 @@
- !type:PlaySoundBehavior - !type:PlaySoundBehavior
sound: sound:
path: /Audio/Effects/metalbreak.ogg path: /Audio/Effects/metalbreak.ogg
placement:
mode: SnapgridCenter
snap:
- Wallmount
- type: entity - type: entity
id: AirAlarmAssembly id: AirAlarmAssembly
name: air alarm assembly name: air alarm assembly
description: An air alarm. Doesn't look like it'll be alarming air any time soon. description: An air alarm. Doesn't look like it'll be alarming air any time soon.
placement:
mode: SnapgridCenter
snap:
- Wallmount
components: components:
- type: WallMount - type: WallMount
- type: Clickable - type: Clickable
@@ -115,7 +127,3 @@
node: assembly node: assembly
- type: Transform - type: Transform
anchored: true anchored: true
placement:
mode: SnapgridCenter
snap:
- Wallmount