Adds a component to require an entity to be powered to receive DeviceNetwork packets. (#11390)
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
namespace Content.Server.DeviceNetwork.Components;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Component that indicates that this device networked entity requires power
|
||||||
|
/// in order to receive a packet. Having this component will cancel all packet events
|
||||||
|
/// if the entity is not powered.
|
||||||
|
/// </summary>
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed class DeviceNetworkRequiresPowerComponent : Component
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using Content.Server.DeviceNetwork.Components;
|
||||||
|
using Content.Server.Power.Components;
|
||||||
|
using Content.Server.Power.EntitySystems;
|
||||||
|
|
||||||
|
namespace Content.Server.DeviceNetwork.Systems;
|
||||||
|
|
||||||
|
public sealed class DeviceNetworkRequiresPowerSystem : EntitySystem
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
SubscribeLocalEvent<DeviceNetworkRequiresPowerComponent, BeforePacketSentEvent>(OnBeforePacketSent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnBeforePacketSent(EntityUid uid, DeviceNetworkRequiresPowerComponent component,
|
||||||
|
BeforePacketSentEvent args)
|
||||||
|
{
|
||||||
|
if (!this.IsPowered(uid, EntityManager))
|
||||||
|
{
|
||||||
|
args.Cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
- type: DeviceNetwork
|
- type: DeviceNetwork
|
||||||
deviceNetId: AtmosDevices
|
deviceNetId: AtmosDevices
|
||||||
receiveFrequencyId: AtmosMonitor
|
receiveFrequencyId: AtmosMonitor
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: InteractionOutline
|
- type: InteractionOutline
|
||||||
- type: Damageable
|
- type: Damageable
|
||||||
damageContainer: Inorganic
|
damageContainer: Inorganic
|
||||||
|
|||||||
@@ -640,6 +640,7 @@
|
|||||||
receiveFrequencyId: SurveillanceCamera
|
receiveFrequencyId: SurveillanceCamera
|
||||||
transmitFrequencyId: SurveillanceCamera
|
transmitFrequencyId: SurveillanceCamera
|
||||||
- type: WiredNetworkConnection
|
- type: WiredNetworkConnection
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: SurveillanceCameraMonitor
|
- type: SurveillanceCameraMonitor
|
||||||
- type: ActivatableUI
|
- type: ActivatableUI
|
||||||
key: enum.SurveillanceCameraMonitorUiKey.Key
|
key: enum.SurveillanceCameraMonitorUiKey.Key
|
||||||
@@ -670,6 +671,7 @@
|
|||||||
transmitFrequencyId: SurveillanceCamera
|
transmitFrequencyId: SurveillanceCamera
|
||||||
- type: WirelessNetworkConnection
|
- type: WirelessNetworkConnection
|
||||||
range: 200
|
range: 200
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: SurveillanceCameraMonitor
|
- type: SurveillanceCameraMonitor
|
||||||
- type: ActivatableUI
|
- type: ActivatableUI
|
||||||
key: enum.SurveillanceCameraMonitorUiKey.Key
|
key: enum.SurveillanceCameraMonitorUiKey.Key
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
receiveFrequencyId: SurveillanceCamera
|
receiveFrequencyId: SurveillanceCamera
|
||||||
transmitFrequencyId: SurveillanceCamera
|
transmitFrequencyId: SurveillanceCamera
|
||||||
- type: WiredNetworkConnection
|
- type: WiredNetworkConnection
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.SurveillanceCameraSetupUiKey.Router
|
- key: enum.SurveillanceCameraSetupUiKey.Router
|
||||||
@@ -114,6 +115,7 @@
|
|||||||
transmitFrequencyId: SurveillanceCamera
|
transmitFrequencyId: SurveillanceCamera
|
||||||
- type: WirelessNetworkConnection
|
- type: WirelessNetworkConnection
|
||||||
range: 200
|
range: 200
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.SurveillanceCameraSetupUiKey.Router
|
- key: enum.SurveillanceCameraSetupUiKey.Router
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
prefix: device-address-prefix-vent
|
prefix: device-address-prefix-vent
|
||||||
sendBroadcastAttemptEvent: true
|
sendBroadcastAttemptEvent: true
|
||||||
- type: WiredNetworkConnection
|
- type: WiredNetworkConnection
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: AtmosDevice
|
- type: AtmosDevice
|
||||||
- type: AtmosMonitor
|
- type: AtmosMonitor
|
||||||
temperatureThreshold: stationTemperature
|
temperatureThreshold: stationTemperature
|
||||||
@@ -126,6 +127,7 @@
|
|||||||
receiveFrequencyId: AtmosMonitor
|
receiveFrequencyId: AtmosMonitor
|
||||||
transmitFrequencyId: AtmosMonitor
|
transmitFrequencyId: AtmosMonitor
|
||||||
prefix: device-address-prefix-scrubber
|
prefix: device-address-prefix-scrubber
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: AtmosMonitor
|
- type: AtmosMonitor
|
||||||
temperatureThreshold: stationTemperature
|
temperatureThreshold: stationTemperature
|
||||||
pressureThreshold: stationPressure
|
pressureThreshold: stationPressure
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
prefix: device-address-prefix-sensor
|
prefix: device-address-prefix-sensor
|
||||||
sendBroadcastAttemptEvent: true
|
sendBroadcastAttemptEvent: true
|
||||||
- type: WiredNetworkConnection
|
- type: WiredNetworkConnection
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: AtmosDevice
|
- type: AtmosDevice
|
||||||
- type: AtmosMonitor
|
- type: AtmosMonitor
|
||||||
temperatureThreshold: stationTemperature
|
temperatureThreshold: stationTemperature
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
sendBroadcastAttemptEvent: true
|
sendBroadcastAttemptEvent: true
|
||||||
- type: WiredNetworkConnection
|
- type: WiredNetworkConnection
|
||||||
- type: DeviceList
|
- type: DeviceList
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: AtmosAlarmable
|
- type: AtmosAlarmable
|
||||||
syncWith:
|
syncWith:
|
||||||
- AirAlarm
|
- AirAlarm
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
sendBroadcastAttemptEvent: true
|
sendBroadcastAttemptEvent: true
|
||||||
- type: DeviceList
|
- type: DeviceList
|
||||||
- type: WiredNetworkConnection
|
- type: WiredNetworkConnection
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: AtmosDevice
|
- type: AtmosDevice
|
||||||
- type: AtmosAlarmable
|
- type: AtmosAlarmable
|
||||||
syncWith:
|
syncWith:
|
||||||
|
|||||||
@@ -82,6 +82,7 @@
|
|||||||
receiveFrequencyId: SurveillanceCamera
|
receiveFrequencyId: SurveillanceCamera
|
||||||
transmitFrequencyId: SurveillanceCamera
|
transmitFrequencyId: SurveillanceCamera
|
||||||
- type: WiredNetworkConnection
|
- type: WiredNetworkConnection
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: SurveillanceCameraMonitor
|
- type: SurveillanceCameraMonitor
|
||||||
- type: ActivatableUI
|
- type: ActivatableUI
|
||||||
key: enum.SurveillanceCameraMonitorUiKey.Key
|
key: enum.SurveillanceCameraMonitorUiKey.Key
|
||||||
@@ -157,6 +158,7 @@
|
|||||||
transmitFrequencyId: SurveillanceCamera
|
transmitFrequencyId: SurveillanceCamera
|
||||||
- type: WirelessNetworkConnection
|
- type: WirelessNetworkConnection
|
||||||
range: 200
|
range: 200
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: SurveillanceCameraMonitor
|
- type: SurveillanceCameraMonitor
|
||||||
- type: ActivatableUI
|
- type: ActivatableUI
|
||||||
key: enum.SurveillanceCameraMonitorUiKey.Key
|
key: enum.SurveillanceCameraMonitorUiKey.Key
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
- type: ExtensionCableReceiver
|
- type: ExtensionCableReceiver
|
||||||
- type: Eye
|
- type: Eye
|
||||||
- type: WiredNetworkConnection
|
- type: WiredNetworkConnection
|
||||||
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: Transform
|
- type: Transform
|
||||||
anchored: true
|
anchored: true
|
||||||
- type: Wires
|
- type: Wires
|
||||||
|
|||||||
Reference in New Issue
Block a user