Files
tbd-station-14/Content.Server/DeviceNetwork/Components/DeviceNetworkComponent.cs
Julian Giebel f4be8b5793 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>
2022-06-09 18:28:24 -07:00

99 lines
3.6 KiB
C#

using Content.Server.DeviceNetwork.Systems;
using Content.Shared.DeviceNetwork;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.DeviceNetwork.Components
{
[RegisterComponent]
[Access(typeof(DeviceNetworkSystem), typeof(DeviceNet))]
public sealed class DeviceNetworkComponent : Component
{
public enum DeviceNetIdDefaults
{
Private,
Wired,
Wireless,
Apc,
AtmosDevices,
Reserved = 100,
// Ids outside this enum may exist
// This exists to let yml use nice names instead of numbers
}
[DataField("deviceNetId")]
public DeviceNetIdDefaults NetIdEnum { get; set; }
public int DeviceNetId => (int) NetIdEnum;
/// <summary>
/// The frequency that this device is listening on.
/// </summary>
[DataField("receiveFrequency")]
public uint? ReceiveFrequency;
/// <summary>
/// frequency prototype. Used to select a default frequency to listen to on. Used when the map is
/// initialized.
/// </summary>
[DataField("receiveFrequencyId", customTypeSerializer: typeof(PrototypeIdSerializer<DeviceFrequencyPrototype>))]
public string? ReceiveFrequencyId;
/// <summary>
/// The frequency that this device going to try transmit on.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("transmitFrequency")]
public uint? TransmitFrequency;
/// <summary>
/// frequency prototype. Used to select a default frequency to transmit on. Used when the map is
/// initialized.
/// </summary>
[DataField("transmitFrequencyId", customTypeSerializer: typeof(PrototypeIdSerializer<DeviceFrequencyPrototype>))]
public string? TransmitFrequencyId;
/// <summary>
/// The address of the device, either on the network it is currently connected to or whatever address it
/// most recently used.
/// </summary>
[DataField("address")]
public string Address = string.Empty;
/// <summary>
/// If true, the address was customized and should be preserved across networks. If false, a randomly
/// generated address will be created whenever this device connects to a network.
/// </summary>
[DataField("customAddress")]
public bool CustomAddress = false;
/// <summary>
/// Prefix to prepend to any automatically generated addresses. Helps players to identify devices. This gets
/// localized.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("prefix")]
public string? Prefix;
/// <summary>
/// Whether the device should listen for all device messages, regardless of the intended recipient.
/// </summary>
[DataField("receiveAll")]
public bool ReceiveAll;
/// <summary>
/// Whether the device should attempt to join the network on map init.
/// </summary>
[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;
}
}