devicelistsystem now emits an event when a device list is updated
This commit is contained in:
@@ -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; }
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user