adds examinable text for address to some device networked entities (#11455)

This commit is contained in:
Flipp Syder
2022-09-22 12:00:54 -07:00
committed by GitHub
parent 5464e8a0d7
commit b6a548fb97
7 changed files with 28 additions and 0 deletions

View File

@@ -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>