using Content.Shared.DeviceNetwork.Systems;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.DeviceNetwork.Components
{
[RegisterComponent]
[Access(typeof(SharedDeviceNetworkSystem), typeof(DeviceNet))]
public sealed partial 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;
///
/// The frequency that this device is listening on.
///
[DataField("receiveFrequency")]
public uint? ReceiveFrequency;
///
/// frequency prototype. Used to select a default frequency to listen to on. Used when the map is
/// initialized.
///
[DataField("receiveFrequencyId", customTypeSerializer: typeof(PrototypeIdSerializer))]
public string? ReceiveFrequencyId;
///
/// The frequency that this device going to try transmit on.
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("transmitFrequency")]
public uint? TransmitFrequency;
///
/// frequency prototype. Used to select a default frequency to transmit on. Used when the map is
/// initialized.
///
[DataField("transmitFrequencyId", customTypeSerializer: typeof(PrototypeIdSerializer))]
public string? TransmitFrequencyId;
///
/// The address of the device, either on the network it is currently connected to or whatever address it
/// most recently used.
///
[DataField("address")]
public string Address = string.Empty;
///
/// 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.
///
[DataField("customAddress")]
public bool CustomAddress = false;
///
/// Prefix to prepend to any automatically generated addresses. Helps players to identify devices. This gets
/// localized.
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("prefix")]
public string? Prefix;
///
/// Whether the device should listen for all device messages, regardless of the intended recipient.
///
[DataField("receiveAll")]
public bool ReceiveAll;
///
/// If the device should show its address upon an examine. Useful for devices
/// that do not have a visible UI.
///
[DataField("examinableAddress")]
public bool ExaminableAddress;
///
/// Whether the device should attempt to join the network on map init.
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("autoConnect")]
public bool AutoConnect = true;
///
/// Whether to send the broadcast recipients list to the sender so it can be filtered.
///
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("sendBroadcastAttemptEvent")]
public bool SendBroadcastAttemptEvent = false;
///
/// Whether this device's address can be saved to device-lists
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("savableAddress")]
public bool SavableAddress = true;
///
/// A list of device-lists that this device is on.
///
[DataField]
[Access(typeof(SharedDeviceListSystem))]
public HashSet DeviceLists = new();
///
/// A list of configurators that this device is on.
///
[DataField]
[Access(typeof(SharedNetworkConfiguratorSystem))]
public HashSet Configurators = new();
}
}