Removes hacky behavior from DeviceListSystem (#11255)
This commit is contained in:
@@ -12,10 +12,16 @@ public sealed class DeviceListSystem : SharedDeviceListSystem
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<DeviceListComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<DeviceListComponent, BeforeBroadcastAttemptEvent>(OnBeforeBroadcast);
|
||||
SubscribeLocalEvent<DeviceListComponent, BeforePacketSentEvent>(OnBeforePacketSent);
|
||||
}
|
||||
|
||||
public void OnInit(EntityUid uid, DeviceListComponent component, ComponentInit args)
|
||||
{
|
||||
Dirty(component);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the given device list as a dictionary
|
||||
/// </summary>
|
||||
|
||||
@@ -46,7 +46,6 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
|
||||
SubscribeLocalEvent<NetworkConfiguratorComponent, NetworkConfiguratorRemoveDeviceMessage>(OnRemoveDevice);
|
||||
SubscribeLocalEvent<NetworkConfiguratorComponent, NetworkConfiguratorClearDevicesMessage>(OnClearDevice);
|
||||
SubscribeLocalEvent<NetworkConfiguratorComponent, NetworkConfiguratorButtonPressedMessage>(OnConfigButtonPressed);
|
||||
SubscribeLocalEvent<NetworkConfiguratorComponent, ManualDeviceListSyncMessage>(ManualDeviceListSync);
|
||||
|
||||
SubscribeLocalEvent<DeviceListComponent, ComponentRemove>(OnComponentRemoved);
|
||||
}
|
||||
@@ -330,20 +329,5 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
|
||||
_deviceListSystem.GetDeviceList(component.ActiveDeviceList.Value)
|
||||
.Select(v => (v.Key, MetaData(v.Value).EntityName)).ToHashSet()));
|
||||
}
|
||||
|
||||
// hacky solution related to mapping
|
||||
private void ManualDeviceListSync(EntityUid uid, NetworkConfiguratorComponent comp,
|
||||
ManualDeviceListSyncMessage args)
|
||||
{
|
||||
if (comp.ActiveDeviceList == null || args.Session is not IPlayerSession player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var devices = _deviceListSystem.GetAllDevices(comp.ActiveDeviceList.Value).ToHashSet();
|
||||
|
||||
_uiSystem.TrySendUiMessage(uid, NetworkConfiguratorUiKey.Configure, new ManualDeviceListSyncMessage(comp.ActiveDeviceList.Value, devices), player);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user