Files
tbd-station-14/Content.Shared/DeviceNetwork/Components/DeviceListComponent.cs
Flipp Syder c3d7ecace6 Adds a link limit and UI to device list (#11017)
* adds a link limit to device list

* locale strings

* uhhh what's efcore doing there

* adds a UI for device list on the device

* merge conflict fixing
2022-09-05 18:22:39 -07:00

53 lines
1.6 KiB
C#

using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.DeviceNetwork;
[RegisterComponent]
[NetworkedComponent]
[Access(typeof(SharedDeviceListSystem))]
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>
/// The limit of devices that can be linked to this device list.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("deviceLimit")]
public int DeviceLimit = 32;
/// <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;
}
[Serializable, NetSerializable]
public sealed class DeviceListComponentState : ComponentState
{
public readonly HashSet<EntityUid> Devices;
public readonly bool IsAllowList;
public readonly bool HandleIncomingPackets;
public DeviceListComponentState(HashSet<EntityUid> devices, bool isAllowList, bool handleIncomingPackets)
{
Devices = devices;
IsAllowList = isAllowList;
HandleIncomingPackets = handleIncomingPackets;
}
}