Device link visualizer (#11054)
* shuffles devicelist to shared, adds an overlay for devicelist * adds space property to overlay * moves networkconfigurator to shared, makes devicelistsystem clientside check activedevicelist * dirties components upon change, adds networkedcomponent to sharednetworkconfigurator * state handlers for networked components * whoops * lots of shuffling, renaming, and access changes * randomizes color for every new entity added to the overlay * adds a client-side action to clear all network overlays if they're active * clones action (oops) * localization, adds a command for clearing network link overlays (in case the action disappears) * moves the entity manager up into the bui fields * makes that a dependency * attempts to just directly get the color from the dict when drawing, now * fixes up a few comments * adds dirty on init to devicelistcomponent * hacky solution related to mapping with a networkconfigurator * more stricter bound on that hacky solution * just checks if the life stage is initialized instead of if the entity was initialized * moves getalldevices to shared * readds linq import * tries to ensure that the show button is toggled on if the device we're trying to configure is currently being tracked by the overlay * some reorganization
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
using System.Linq;
|
||||
using Content.Server.DeviceNetwork.Components;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.Interaction;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.DeviceNetwork.Systems;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class DeviceListSystem : EntitySystem
|
||||
public sealed class DeviceListSystem : SharedDeviceListSystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -15,23 +16,6 @@ public sealed class DeviceListSystem : EntitySystem
|
||||
SubscribeLocalEvent<DeviceListComponent, BeforePacketSentEvent>(OnBeforePacketSent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces or merges the current device list with the given one
|
||||
/// </summary>
|
||||
public void UpdateDeviceList(EntityUid uid, IEnumerable<EntityUid> devices, bool merge = false, DeviceListComponent? deviceList = null)
|
||||
{
|
||||
if (!Resolve(uid, ref deviceList))
|
||||
return;
|
||||
|
||||
if (!merge)
|
||||
deviceList.Devices.Clear();
|
||||
|
||||
var devicesList = devices.ToList();
|
||||
deviceList.Devices.UnionWith(devicesList);
|
||||
|
||||
RaiseLocalEvent(uid, new DeviceListUpdateEvent(devicesList));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the given device list as a dictionary
|
||||
/// </summary>
|
||||
@@ -54,16 +38,6 @@ public sealed class DeviceListSystem : EntitySystem
|
||||
return devices;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the given device lists connection visualisation on and off.
|
||||
/// TODO: Implement an overlay that draws a line between the given entity and the entities in the device list
|
||||
/// </summary>
|
||||
public void ToggleVisualization(EntityUid uid, bool ensureOff = false, DeviceListComponent? deviceList = null)
|
||||
{
|
||||
if (!Resolve(uid, ref deviceList))
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Filters the broadcasts recipient list against the device list as either an allow or deny list depending on the components IsAllowList field
|
||||
/// </summary>
|
||||
@@ -95,13 +69,3 @@ public sealed class DeviceListSystem : EntitySystem
|
||||
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