Remove devices from device lists when they get deleted (#16783)
* Implement device network device shutdown subscribtion Implement removing devices from device lists when they get deleted * Improve name and doc comment for DeviceShutDownEvent * Change ShutdownSubscriber data field tag * Change UpdateRemovalSubscription name to UpdateShutdownSubscription
This commit is contained in:
@@ -2,7 +2,7 @@ using System.Linq;
|
||||
using Content.Shared.DeviceNetwork.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.DeviceNetwork;
|
||||
namespace Content.Shared.DeviceNetwork.Systems;
|
||||
|
||||
public abstract class SharedDeviceListSystem : EntitySystem
|
||||
{
|
||||
@@ -36,6 +36,8 @@ public abstract class SharedDeviceListSystem : EntitySystem
|
||||
|
||||
deviceList.Devices = newDevices;
|
||||
|
||||
UpdateShutdownSubscription(uid, devicesList, oldDevices);
|
||||
|
||||
RaiseLocalEvent(uid, new DeviceListUpdateEvent(oldDevices, devicesList));
|
||||
|
||||
Dirty(deviceList);
|
||||
@@ -52,6 +54,10 @@ public abstract class SharedDeviceListSystem : EntitySystem
|
||||
return component.Devices;
|
||||
}
|
||||
|
||||
protected virtual void UpdateShutdownSubscription(EntityUid uid, List<EntityUid> devicesList, List<EntityUid> oldDevices)
|
||||
{
|
||||
}
|
||||
|
||||
private void GetDeviceListState(EntityUid uid, DeviceListComponent comp, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new DeviceListComponentState(comp.Devices, comp.IsAllowList, comp.HandleIncomingPackets);
|
||||
|
||||
Reference in New Issue
Block a user