Files
tbd-station-14/Content.Shared/Cuffs/Components/CuffableComponent.cs
Princess Cheeseballs 04b71d8203 Make CuffableComponent and CuffableSystem not Crash (Hopefully) (#39123)
* This system is ancient

* Destroy that API

* Address reviews

* Destroy merge conflicts from orbit

* seems to work fine

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
2025-11-01 13:22:13 +00:00

67 lines
2.0 KiB
C#

using Content.Shared.Alert;
using Content.Shared.Damage;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
namespace Content.Shared.Cuffs.Components;
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedCuffableSystem))]
public sealed partial class CuffableComponent : Component
{
/// <summary>
/// The current RSI for the handcuff layer
/// </summary>
[DataField("currentRSI"), ViewVariables(VVAccess.ReadWrite)]
public string? CurrentRSI;
/// <summary>
/// How many of this entity's hands are currently cuffed.
/// </summary>
[ViewVariables]
public int CuffedHandCount => Container.ContainedEntities.Count * 2;
/// <summary>
/// Container of various handcuffs currently applied to the entity.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public Container Container = default!;
/// <summary>
/// Whether or not the entity can still interact (is not cuffed)
/// </summary>
[DataField("canStillInteract"), ViewVariables(VVAccess.ReadWrite)]
public bool CanStillInteract = true;
[DataField]
public ProtoId<AlertPrototype> CuffedAlert = "Handcuffed";
}
public sealed partial class RemoveCuffsAlertEvent : BaseAlertEvent;
[Serializable, NetSerializable]
public sealed class CuffableComponentState : ComponentState
{
public readonly bool CanStillInteract;
public readonly int NumHandsCuffed;
public readonly string? RSI;
public readonly string? IconState;
public readonly Color? Color;
public CuffableComponentState(int numHandsCuffed, bool canStillInteract, string? rsiPath, string? iconState, Color? color)
{
NumHandsCuffed = numHandsCuffed;
CanStillInteract = canStillInteract;
RSI = rsiPath;
IconState = iconState;
Color = color;
}
}
[ByRefEvent]
public readonly record struct CuffedStateChangeEvent;