using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Utility;
namespace Content.Shared.Cuffs.Components;
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedCuffableSystem))]
public sealed class HandcuffComponent : Component
{
///
/// The time it takes to cuff an entity.
///
[DataField("cuffTime"), ViewVariables(VVAccess.ReadWrite)]
public float CuffTime = 3.5f;
///
/// The time it takes to uncuff an entity.
///
[DataField("uncuffTime"), ViewVariables(VVAccess.ReadWrite)]
public float UncuffTime = 3.5f;
///
/// The time it takes for a cuffed entity to uncuff itself.
///
[DataField("breakoutTime"), ViewVariables(VVAccess.ReadWrite)]
public float BreakoutTime = 30f;
///
/// If an entity being cuffed is stunned, this amount of time is subtracted from the time it takes to add/remove their cuffs.
///
[DataField("stunBonus"), ViewVariables(VVAccess.ReadWrite)]
public float StunBonus = 2f;
///
/// Will the cuffs break when removed?
///
[DataField("breakOnRemove"), ViewVariables(VVAccess.ReadWrite)]
public bool BreakOnRemove;
///
/// Will the cuffs break when removed?
///
[DataField("brokenPrototype", customTypeSerializer: typeof(PrototypeIdSerializer)), ViewVariables(VVAccess.ReadWrite)]
public string? BrokenPrototype;
///
/// The path of the RSI file used for the player cuffed overlay.
///
[DataField("cuffedRSI"), ViewVariables(VVAccess.ReadWrite)]
public string? CuffedRSI = "Objects/Misc/handcuffs.rsi";
///
/// The iconstate used with the RSI file for the player cuffed overlay.
///
[DataField("bodyIconState"), ViewVariables(VVAccess.ReadWrite)]
public string? OverlayIconState = "body-overlay";
///
/// An opptional color specification for
///
[DataField("color"), ViewVariables(VVAccess.ReadWrite)]
public Color Color = Color.White;
[DataField("startCuffSound"), ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier StartCuffSound = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_start.ogg");
[DataField("endCuffSound"), ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier EndCuffSound = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_end.ogg");
[DataField("startBreakoutSound"), ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier StartBreakoutSound = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_breakout_start.ogg");
[DataField("startUncuffSound"), ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier StartUncuffSound = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_takeoff_start.ogg");
[DataField("endUncuffSound"), ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier EndUncuffSound = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_takeoff_end.ogg");
///
/// Used to prevent DoAfter getting spammed.
///
[DataField("cuffing"), ViewVariables(VVAccess.ReadWrite)]
public bool Cuffing;
}
[Serializable, NetSerializable]
public sealed class HandcuffComponentState : ComponentState
{
public readonly string? IconState;
public readonly bool Cuffing;
public HandcuffComponentState(string? iconState, bool cuffing)
{
IconState = iconState;
Cuffing = cuffing;
}
}
///
/// Event fired on the User when the User attempts to cuff the Target.
/// Should generate popups on the User.
///
[ByRefEvent]
public record struct UncuffAttemptEvent(EntityUid User, EntityUid Target)
{
public readonly EntityUid User = User;
public readonly EntityUid Target = Target;
public bool Cancelled = false;
}