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")]
|
[DataField("receiveAll")]
|
||||||
public bool 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>
|
/// <summary>
|
||||||
/// Whether the device should attempt to join the network on map init.
|
/// Whether the device should attempt to join the network on map init.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Robust.Shared.Random;
|
|||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Content.Shared.Examine;
|
||||||
using static Content.Server.DeviceNetwork.Components.DeviceNetworkComponent;
|
using static Content.Server.DeviceNetwork.Components.DeviceNetworkComponent;
|
||||||
|
|
||||||
namespace Content.Server.DeviceNetwork.Systems
|
namespace Content.Server.DeviceNetwork.Systems
|
||||||
@@ -28,6 +29,7 @@ namespace Content.Server.DeviceNetwork.Systems
|
|||||||
{
|
{
|
||||||
SubscribeLocalEvent<DeviceNetworkComponent, MapInitEvent>(OnMapInit);
|
SubscribeLocalEvent<DeviceNetworkComponent, MapInitEvent>(OnMapInit);
|
||||||
SubscribeLocalEvent<DeviceNetworkComponent, ComponentShutdown>(OnNetworkShutdown);
|
SubscribeLocalEvent<DeviceNetworkComponent, ComponentShutdown>(OnNetworkShutdown);
|
||||||
|
SubscribeLocalEvent<DeviceNetworkComponent, ExaminedEvent>(OnExamine);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
@@ -59,6 +61,15 @@ namespace Content.Server.DeviceNetwork.Systems
|
|||||||
if (frequency != null)
|
if (frequency != null)
|
||||||
_packets.Enqueue(new DeviceNetworkPacketEvent(device.DeviceNetId, address, frequency.Value, device.Address, uid, data));
|
_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>
|
/// <summary>
|
||||||
/// Automatically attempt to connect some devices when a map starts.
|
/// Automatically attempt to connect some devices when a map starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -20,3 +20,7 @@ device-frequency-prototype-name-surveillance-camera-entertainment = Entertainmen
|
|||||||
device-address-prefix-vent = Vnt-
|
device-address-prefix-vent = Vnt-
|
||||||
device-address-prefix-scrubber = Scr-
|
device-address-prefix-scrubber = Scr-
|
||||||
device-address-prefix-sensor = Sns-
|
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
|
transmitFrequencyId: AtmosMonitor
|
||||||
prefix: device-address-prefix-vent
|
prefix: device-address-prefix-vent
|
||||||
sendBroadcastAttemptEvent: true
|
sendBroadcastAttemptEvent: true
|
||||||
|
examinableAddress: true
|
||||||
- type: WiredNetworkConnection
|
- type: WiredNetworkConnection
|
||||||
- type: DeviceNetworkRequiresPower
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: AtmosDevice
|
- type: AtmosDevice
|
||||||
@@ -127,6 +128,7 @@
|
|||||||
receiveFrequencyId: AtmosMonitor
|
receiveFrequencyId: AtmosMonitor
|
||||||
transmitFrequencyId: AtmosMonitor
|
transmitFrequencyId: AtmosMonitor
|
||||||
prefix: device-address-prefix-scrubber
|
prefix: device-address-prefix-scrubber
|
||||||
|
examinableAddress: true
|
||||||
- type: DeviceNetworkRequiresPower
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: AtmosMonitor
|
- type: AtmosMonitor
|
||||||
temperatureThreshold: stationTemperature
|
temperatureThreshold: stationTemperature
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
transmitFrequencyId: AtmosMonitor
|
transmitFrequencyId: AtmosMonitor
|
||||||
prefix: device-address-prefix-sensor
|
prefix: device-address-prefix-sensor
|
||||||
sendBroadcastAttemptEvent: true
|
sendBroadcastAttemptEvent: true
|
||||||
|
examinableAddress: true
|
||||||
- type: WiredNetworkConnection
|
- type: WiredNetworkConnection
|
||||||
- type: DeviceNetworkRequiresPower
|
- type: DeviceNetworkRequiresPower
|
||||||
- type: AtmosDevice
|
- type: AtmosDevice
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
deviceNetId: AtmosDevices
|
deviceNetId: AtmosDevices
|
||||||
receiveFrequencyId: AtmosMonitor
|
receiveFrequencyId: AtmosMonitor
|
||||||
transmitFrequencyId: AtmosMonitor
|
transmitFrequencyId: AtmosMonitor
|
||||||
|
prefix: device-address-prefix-air-alarm
|
||||||
sendBroadcastAttemptEvent: true
|
sendBroadcastAttemptEvent: true
|
||||||
- type: WiredNetworkConnection
|
- type: WiredNetworkConnection
|
||||||
- type: DeviceList
|
- type: DeviceList
|
||||||
|
|||||||
@@ -13,7 +13,9 @@
|
|||||||
deviceNetId: AtmosDevices
|
deviceNetId: AtmosDevices
|
||||||
receiveFrequencyId: AtmosMonitor
|
receiveFrequencyId: AtmosMonitor
|
||||||
transmitFrequencyId: AtmosMonitor
|
transmitFrequencyId: AtmosMonitor
|
||||||
|
prefix: device-address-prefix-fire-alarm
|
||||||
sendBroadcastAttemptEvent: true
|
sendBroadcastAttemptEvent: true
|
||||||
|
examinableAddress: true
|
||||||
- type: DeviceList
|
- type: DeviceList
|
||||||
- type: WiredNetworkConnection
|
- type: WiredNetworkConnection
|
||||||
- type: DeviceNetworkRequiresPower
|
- type: DeviceNetworkRequiresPower
|
||||||
|
|||||||
Reference in New Issue
Block a user