using Content.Shared.DeviceLinking;
using Content.Shared.DeviceNetwork.Systems;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.DeviceNetwork.Components;
[RegisterComponent]
[NetworkedComponent]
[Access(typeof(SharedNetworkConfiguratorSystem))]
public sealed class NetworkConfiguratorComponent : Component
{
///
/// Determines whether the configurator is in linking mode or list mode
///
[DataField("linkModeActive")]
[ViewVariables(VVAccess.ReadWrite)]
public bool LinkModeActive = false;
///
/// The entity containing a this configurator is currently interacting with
///
[DataField("activeDeviceList")]
public EntityUid? ActiveDeviceList = null;
///
/// The entity containing a or this configurator is currently interacting with.
/// If this is set the configurator is in linking mode.
///
[DataField("activeDeviceLink")]
public EntityUid? ActiveDeviceLink = null;
///
/// The target device this configurator is currently linking with the
///
[DataField("deviceLinkTarget")]
public EntityUid? DeviceLinkTarget = null;
///
/// The list of devices stored in the configurator
///
[DataField("devices")]
public Dictionary Devices = new();
[DataField("useDelay")]
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan UseDelay = TimeSpan.FromSeconds(0.5);
[DataField("lastUseAttempt", customTypeSerializer:typeof(TimeOffsetSerializer))]
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan LastUseAttempt;
[DataField("soundNoAccess")]
public SoundSpecifier SoundNoAccess = new SoundPathSpecifier("/Audio/Machines/custom_deny.ogg");
[DataField("soundSwitchMode")]
public SoundSpecifier SoundSwitchMode = new SoundPathSpecifier("/Audio/Machines/beep.ogg");
}
[Serializable, NetSerializable]
public sealed class NetworkConfiguratorComponentState : ComponentState
{
public readonly EntityUid? ActiveDeviceList;
public readonly bool LinkModeActive;
public NetworkConfiguratorComponentState(EntityUid? activeDeviceList, bool linkModeActive)
{
ActiveDeviceList = activeDeviceList;
LinkModeActive = linkModeActive;
}
}