2023-05-07 08:07:24 +02:00
using Content.Shared.DeviceLinking ;
using Content.Shared.DeviceNetwork.Systems ;
2022-07-29 14:13:12 +12:00
using Robust.Shared.Audio ;
2022-09-05 17:55:44 -07:00
using Robust.Shared.GameStates ;
using Robust.Shared.Serialization ;
2023-05-07 08:07:24 +02:00
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom ;
2022-06-10 03:28:24 +02:00
2023-05-07 08:07:24 +02:00
namespace Content.Shared.DeviceNetwork.Components ;
2022-06-10 03:28:24 +02:00
[RegisterComponent]
2022-09-05 17:55:44 -07:00
[NetworkedComponent]
[Access(typeof(SharedNetworkConfiguratorSystem))]
2022-06-10 03:28:24 +02:00
public sealed class NetworkConfiguratorComponent : Component
{
2023-05-07 08:07:24 +02:00
/// <summary>
/// Determines whether the configurator is in linking mode or list mode
/// </summary>
[DataField("linkModeActive")]
[ViewVariables(VVAccess.ReadWrite)]
2023-05-07 12:58:12 +02:00
public bool LinkModeActive = true ;
2023-05-07 08:07:24 +02:00
2022-06-10 03:28:24 +02:00
/// <summary>
/// The entity containing a <see cref="DeviceListComponent"/> this configurator is currently interacting with
/// </summary>
[DataField("activeDeviceList")]
public EntityUid ? ActiveDeviceList = null ;
2022-09-05 17:55:44 -07:00
/// <summary>
2023-05-07 08:07:24 +02:00
/// The entity containing a <see cref="DeviceLinkSourceComponent"/> or <see cref="DeviceLinkSinkComponent"/> this configurator is currently interacting with.<br/>
/// If this is set the configurator is in linking mode.
/// </summary>
[DataField("activeDeviceLink")]
public EntityUid ? ActiveDeviceLink = null ;
/// <summary>
/// The target device this configurator is currently linking with the <see cref="ActiveDeviceLink"/>
/// </summary>
[DataField("deviceLinkTarget")]
public EntityUid ? DeviceLinkTarget = null ;
/// <summary>
/// The list of devices stored in the configurator
2022-09-05 17:55:44 -07:00
/// </summary>
[DataField("devices")]
public Dictionary < string , EntityUid > Devices = new ( ) ;
2023-05-07 08:07:24 +02:00
[DataField("useDelay")]
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan UseDelay = TimeSpan . FromSeconds ( 0.5 ) ;
[DataField("lastUseAttempt", customTypeSerializer:typeof(TimeOffsetSerializer))]
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan LastUseAttempt ;
2022-06-10 03:28:24 +02:00
[DataField("soundNoAccess")]
public SoundSpecifier SoundNoAccess = new SoundPathSpecifier ( "/Audio/Machines/custom_deny.ogg" ) ;
2023-05-07 08:07:24 +02:00
[DataField("soundSwitchMode")]
2023-05-22 15:20:53 +02:00
public SoundSpecifier SoundSwitchMode = new SoundPathSpecifier ( "/Audio/Machines/quickbeep.ogg" ) ;
2022-06-10 03:28:24 +02:00
}
2022-09-05 17:55:44 -07:00
[Serializable, NetSerializable]
public sealed class NetworkConfiguratorComponentState : ComponentState
{
public readonly EntityUid ? ActiveDeviceList ;
2023-05-07 08:07:24 +02:00
public readonly bool LinkModeActive ;
2022-09-05 17:55:44 -07:00
2023-05-07 08:07:24 +02:00
public NetworkConfiguratorComponentState ( EntityUid ? activeDeviceList , bool linkModeActive )
2022-09-05 17:55:44 -07:00
{
ActiveDeviceList = activeDeviceList ;
2023-05-07 08:07:24 +02:00
LinkModeActive = linkModeActive ;
2022-09-05 17:55:44 -07:00
}
}