devicelistsystem now emits an event when a device list is updated

This commit is contained in:
vulppine
2022-08-22 01:15:10 -07:00
parent 25bb45aa98
commit 14669f1521

View File

@@ -1,4 +1,5 @@
using Content.Server.DeviceNetwork.Components; using System.Linq;
using Content.Server.DeviceNetwork.Components;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using JetBrains.Annotations; using JetBrains.Annotations;
@@ -25,7 +26,10 @@ public sealed class DeviceListSystem : EntitySystem
if (!merge) if (!merge)
deviceList.Devices.Clear(); deviceList.Devices.Clear();
deviceList.Devices.UnionWith(devices); var devicesList = devices.ToList();
deviceList.Devices.UnionWith(devicesList);
RaiseLocalEvent(uid, new DeviceListUpdateEvent(devicesList));
} }
/// <summary> /// <summary>
@@ -91,3 +95,13 @@ public sealed class DeviceListSystem : EntitySystem
args.Cancel(); args.Cancel();
} }
} }
public sealed class DeviceListUpdateEvent : EntityEventArgs
{
public DeviceListUpdateEvent(List<EntityUid> devices)
{
Devices = devices;
}
public List<EntityUid> Devices { get; }
}