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
|
||||
deviceNetId: AtmosDevices
|
||||
receiveFrequencyId: AtmosMonitor
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: InteractionOutline
|
||||
- type: Damageable
|
||||
damageContainer: Inorganic
|
||||
|
||||
@@ -640,6 +640,7 @@
|
||||
receiveFrequencyId: SurveillanceCamera
|
||||
transmitFrequencyId: SurveillanceCamera
|
||||
- type: WiredNetworkConnection
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: SurveillanceCameraMonitor
|
||||
- type: ActivatableUI
|
||||
key: enum.SurveillanceCameraMonitorUiKey.Key
|
||||
@@ -670,6 +671,7 @@
|
||||
transmitFrequencyId: SurveillanceCamera
|
||||
- type: WirelessNetworkConnection
|
||||
range: 200
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: SurveillanceCameraMonitor
|
||||
- type: ActivatableUI
|
||||
key: enum.SurveillanceCameraMonitorUiKey.Key
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
receiveFrequencyId: SurveillanceCamera
|
||||
transmitFrequencyId: SurveillanceCamera
|
||||
- type: WiredNetworkConnection
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
- key: enum.SurveillanceCameraSetupUiKey.Router
|
||||
@@ -114,6 +115,7 @@
|
||||
transmitFrequencyId: SurveillanceCamera
|
||||
- type: WirelessNetworkConnection
|
||||
range: 200
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
- key: enum.SurveillanceCameraSetupUiKey.Router
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
prefix: device-address-prefix-vent
|
||||
sendBroadcastAttemptEvent: true
|
||||
- type: WiredNetworkConnection
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: AtmosDevice
|
||||
- type: AtmosMonitor
|
||||
temperatureThreshold: stationTemperature
|
||||
@@ -126,6 +127,7 @@
|
||||
receiveFrequencyId: AtmosMonitor
|
||||
transmitFrequencyId: AtmosMonitor
|
||||
prefix: device-address-prefix-scrubber
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: AtmosMonitor
|
||||
temperatureThreshold: stationTemperature
|
||||
pressureThreshold: stationPressure
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
prefix: device-address-prefix-sensor
|
||||
sendBroadcastAttemptEvent: true
|
||||
- type: WiredNetworkConnection
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: AtmosDevice
|
||||
- type: AtmosMonitor
|
||||
temperatureThreshold: stationTemperature
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
sendBroadcastAttemptEvent: true
|
||||
- type: WiredNetworkConnection
|
||||
- type: DeviceList
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: AtmosAlarmable
|
||||
syncWith:
|
||||
- AirAlarm
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
sendBroadcastAttemptEvent: true
|
||||
- type: DeviceList
|
||||
- type: WiredNetworkConnection
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: AtmosDevice
|
||||
- type: AtmosAlarmable
|
||||
syncWith:
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
receiveFrequencyId: SurveillanceCamera
|
||||
transmitFrequencyId: SurveillanceCamera
|
||||
- type: WiredNetworkConnection
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: SurveillanceCameraMonitor
|
||||
- type: ActivatableUI
|
||||
key: enum.SurveillanceCameraMonitorUiKey.Key
|
||||
@@ -157,6 +158,7 @@
|
||||
transmitFrequencyId: SurveillanceCamera
|
||||
- type: WirelessNetworkConnection
|
||||
range: 200
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: SurveillanceCameraMonitor
|
||||
- type: ActivatableUI
|
||||
key: enum.SurveillanceCameraMonitorUiKey.Key
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
- type: ExtensionCableReceiver
|
||||
- type: Eye
|
||||
- type: WiredNetworkConnection
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: Transform
|
||||
anchored: true
|
||||
- type: Wires
|
||||
|
||||
Reference in New Issue
Block a user