From 14669f1521bd927b2f9aeedef8bb4a92b91b885c Mon Sep 17 00:00:00 2001 From: vulppine Date: Mon, 22 Aug 2022 01:15:10 -0700 Subject: [PATCH] devicelistsystem now emits an event when a device list is updated --- .../DeviceNetwork/Systems/DeviceListSystem.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Content.Server/DeviceNetwork/Systems/DeviceListSystem.cs b/Content.Server/DeviceNetwork/Systems/DeviceListSystem.cs index 97a0864a8b..4c73774f0c 100644 --- a/Content.Server/DeviceNetwork/Systems/DeviceListSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/DeviceListSystem.cs @@ -1,4 +1,5 @@ -using Content.Server.DeviceNetwork.Components; +using System.Linq; +using Content.Server.DeviceNetwork.Components; using Content.Shared.Interaction; using JetBrains.Annotations; @@ -25,7 +26,10 @@ public sealed class DeviceListSystem : EntitySystem if (!merge) deviceList.Devices.Clear(); - deviceList.Devices.UnionWith(devices); + var devicesList = devices.ToList(); + deviceList.Devices.UnionWith(devicesList); + + RaiseLocalEvent(uid, new DeviceListUpdateEvent(devicesList)); } /// @@ -91,3 +95,13 @@ public sealed class DeviceListSystem : EntitySystem args.Cancel(); } } + +public sealed class DeviceListUpdateEvent : EntityEventArgs +{ + public DeviceListUpdateEvent(List devices) + { + Devices = devices; + } + + public List Devices { get; } +}