Device network DeviceLists and the NetworkConfigurator (Makes air alarms usable) (#7697)

* Implement DeviceList
Implement NetworkConfigurator
I sould really get into the habit of making smaller commits

* Remove ApcNetworkComponent from vents, scrubbers anf firelocks

* Change BeforeBroadcastAttemptEvent#Recepients to readonly IReadonlySet and add a ModifiedRecepients field

* Address revievs in NetworkConfigurationSystem

* Fix red and green button styles

* Change NetworkConfiguratorSystem#UpdateState to remove saved entites that don't exist anymore

* Add AtmosDevices device net id

* Add const strings for style classes
Fix wrong margin for NetworkConfiguratorConfigurationMenu

* Hello? Github?

* Add access check before opening the configuration ui

* Address reviews

* Fix call to access reader

* You shall not live again IgnoreComponent

* Fix interaction verb check

* Fix configuration window not closing when target gets deleted / out of range

* Change device is already saved message to say 'network device: ... is already saves'

* Apply suggestions from code review

Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>

* Fix applied suggestion

Co-authored-by: wrexbe <81056464+wrexbe@users.noreply.github.com>
Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
This commit is contained in:
Julian Giebel
2022-06-10 03:28:24 +02:00
committed by GitHub
parent 0fc8c0ef5e
commit f4be8b5793
20 changed files with 836 additions and 14 deletions

View File

@@ -0,0 +1,28 @@
using Content.Server.DeviceNetwork.Systems;
namespace Content.Server.DeviceNetwork.Components;
[RegisterComponent]
[Friend(typeof(DeviceListSystem))]
public sealed class DeviceListComponent : Component
{
/// <summary>
/// The list of devices can or can't connect to, depending on the <see cref="IsAllowList"/> field.
/// </summary>
[DataField("devices")]
public HashSet<EntityUid> Devices = new();
/// <summary>
/// Whether the device list is used as an allow or deny list
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("isAllowList")]
public bool IsAllowList = true;
/// <summary>
/// Whether this device list also handles incoming device net packets
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("handleIncoming")]
public bool HandleIncomingPackets = false;
}

View File

@@ -14,6 +14,7 @@ namespace Content.Server.DeviceNetwork.Components
Wired,
Wireless,
Apc,
AtmosDevices,
Reserved = 100,
// Ids outside this enum may exist
// This exists to let yml use nice names instead of numbers
@@ -85,5 +86,13 @@ namespace Content.Server.DeviceNetwork.Components
[ViewVariables(VVAccess.ReadWrite)]
[DataField("autoConnect")]
public bool AutoConnect = true;
/// <summary>
/// Whether to send the broadcast recipients list to the sender so it can be filtered.
/// <see cref="DeviceListSystem"/>
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("sendBroadcastAttemptEvent")]
public bool SendBroadcastAttemptEvent = false;
}
}

View File

@@ -0,0 +1,24 @@
using Content.Server.DeviceNetwork.Systems;
using Content.Shared.Sound;
namespace Content.Server.DeviceNetwork.Components;
[RegisterComponent]
[Friend(typeof(NetworkConfiguratorSystem))]
public sealed class NetworkConfiguratorComponent : Component
{
/// <summary>
/// The list of devices stored in the configurator-
/// </summary>
[DataField("devices")]
public Dictionary<string, EntityUid> Devices = new();
/// <summary>
/// The entity containing a <see cref="DeviceListComponent"/> this configurator is currently interacting with
/// </summary>
[DataField("activeDeviceList")]
public EntityUid? ActiveDeviceList = null;
[DataField("soundNoAccess")]
public SoundSpecifier SoundNoAccess = new SoundPathSpecifier("/Audio/Machines/custom_deny.ogg");
}