adds examinable text for address to some device networked entities (#11455)
This commit is contained in:
@@ -80,6 +80,13 @@ namespace Content.Server.DeviceNetwork.Components
|
||||
[DataField("receiveAll")]
|
||||
public bool ReceiveAll;
|
||||
|
||||
/// <summary>
|
||||
/// If the device should show its address upon an examine. Useful for devices
|
||||
/// that do not have a visible UI.
|
||||
/// </summary>
|
||||
[DataField("examinableAddress")]
|
||||
public bool ExaminableAddress;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the device should attempt to join the network on map init.
|
||||
/// </summary>
|
||||
|
||||
@@ -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<DeviceNetworkComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<DeviceNetworkComponent, ComponentShutdown>(OnNetworkShutdown);
|
||||
SubscribeLocalEvent<DeviceNetworkComponent, ExaminedEvent>(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)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Automatically attempt to connect some devices when a map starts.
|
||||
/// </summary>
|
||||
|
||||
@@ -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}.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
transmitFrequencyId: AtmosMonitor
|
||||
prefix: device-address-prefix-sensor
|
||||
sendBroadcastAttemptEvent: true
|
||||
examinableAddress: true
|
||||
- type: WiredNetworkConnection
|
||||
- type: DeviceNetworkRequiresPower
|
||||
- type: AtmosDevice
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
deviceNetId: AtmosDevices
|
||||
receiveFrequencyId: AtmosMonitor
|
||||
transmitFrequencyId: AtmosMonitor
|
||||
prefix: device-address-prefix-air-alarm
|
||||
sendBroadcastAttemptEvent: true
|
||||
- type: WiredNetworkConnection
|
||||
- type: DeviceList
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user