diff --git a/Content.Server/DeviceNetwork/Components/DeviceNetworkComponent.cs b/Content.Server/DeviceNetwork/Components/DeviceNetworkComponent.cs index 297b2405f3..a50e6c4259 100644 --- a/Content.Server/DeviceNetwork/Components/DeviceNetworkComponent.cs +++ b/Content.Server/DeviceNetwork/Components/DeviceNetworkComponent.cs @@ -80,6 +80,13 @@ namespace Content.Server.DeviceNetwork.Components [DataField("receiveAll")] public bool ReceiveAll; + /// + /// If the device should show its address upon an examine. Useful for devices + /// that do not have a visible UI. + /// + [DataField("examinableAddress")] + public bool ExaminableAddress; + /// /// Whether the device should attempt to join the network on map init. /// diff --git a/Content.Server/DeviceNetwork/Systems/DeviceNetworkSystem.cs b/Content.Server/DeviceNetwork/Systems/DeviceNetworkSystem.cs index 5d3c355712..78f13d995a 100644 --- a/Content.Server/DeviceNetwork/Systems/DeviceNetworkSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/DeviceNetworkSystem.cs @@ -6,6 +6,7 @@ using Robust.Shared.Random; using Robust.Shared.Utility; using System.Buffers; using System.Diagnostics.CodeAnalysis; +using Content.Shared.Examine; using static Content.Server.DeviceNetwork.Components.DeviceNetworkComponent; namespace Content.Server.DeviceNetwork.Systems @@ -28,6 +29,7 @@ namespace Content.Server.DeviceNetwork.Systems { SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnNetworkShutdown); + SubscribeLocalEvent(OnExamine); } public override void Update(float frameTime) @@ -59,6 +61,15 @@ namespace Content.Server.DeviceNetwork.Systems if (frequency != null) _packets.Enqueue(new DeviceNetworkPacketEvent(device.DeviceNetId, address, frequency.Value, device.Address, uid, data)); } + + private void OnExamine(EntityUid uid, DeviceNetworkComponent device, ExaminedEvent args) + { + if (device.ExaminableAddress) + { + args.PushText(Loc.GetString("device-address-examine-message", ("address", device.Address))); + } + } + /// /// Automatically attempt to connect some devices when a map starts. /// diff --git a/Resources/Locale/en-US/devices/device-network.ftl b/Resources/Locale/en-US/devices/device-network.ftl index 24ceccc49b..94ae8b80bb 100644 --- a/Resources/Locale/en-US/devices/device-network.ftl +++ b/Resources/Locale/en-US/devices/device-network.ftl @@ -20,3 +20,7 @@ device-frequency-prototype-name-surveillance-camera-entertainment = Entertainmen device-address-prefix-vent = Vnt- device-address-prefix-scrubber = Scr- device-address-prefix-sensor = Sns- +device-address-prefix-fire-alarm = Fir- +device-address-prefix-air-alarm = Air- + +device-address-examine-message = The device's address is {$address}. diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml index dc2e713b2c..2e5f06e457 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml @@ -35,6 +35,7 @@ transmitFrequencyId: AtmosMonitor prefix: device-address-prefix-vent sendBroadcastAttemptEvent: true + examinableAddress: true - type: WiredNetworkConnection - type: DeviceNetworkRequiresPower - type: AtmosDevice @@ -127,6 +128,7 @@ receiveFrequencyId: AtmosMonitor transmitFrequencyId: AtmosMonitor prefix: device-address-prefix-scrubber + examinableAddress: true - type: DeviceNetworkRequiresPower - type: AtmosMonitor temperatureThreshold: stationTemperature diff --git a/Resources/Prototypes/Entities/Structures/Specific/Atmospherics/sensor.yml b/Resources/Prototypes/Entities/Structures/Specific/Atmospherics/sensor.yml index 19aaa24c2a..6988eaa9d7 100644 --- a/Resources/Prototypes/Entities/Structures/Specific/Atmospherics/sensor.yml +++ b/Resources/Prototypes/Entities/Structures/Specific/Atmospherics/sensor.yml @@ -40,6 +40,7 @@ transmitFrequencyId: AtmosMonitor prefix: device-address-prefix-sensor sendBroadcastAttemptEvent: true + examinableAddress: true - type: WiredNetworkConnection - type: DeviceNetworkRequiresPower - type: AtmosDevice diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml index 9704f1f513..3d583ff481 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml @@ -13,6 +13,7 @@ deviceNetId: AtmosDevices receiveFrequencyId: AtmosMonitor transmitFrequencyId: AtmosMonitor + prefix: device-address-prefix-air-alarm sendBroadcastAttemptEvent: true - type: WiredNetworkConnection - type: DeviceList diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml index 6970d983e8..756d31d8ba 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml @@ -13,7 +13,9 @@ deviceNetId: AtmosDevices receiveFrequencyId: AtmosMonitor transmitFrequencyId: AtmosMonitor + prefix: device-address-prefix-fire-alarm sendBroadcastAttemptEvent: true + examinableAddress: true - type: DeviceList - type: WiredNetworkConnection - type: DeviceNetworkRequiresPower