* 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>
38 lines
1.6 KiB
C#
38 lines
1.6 KiB
C#
using Content.Shared.Cuffs;
|
|
using Content.Shared.Cuffs.Components;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.GameStates;
|
|
|
|
namespace Content.Server.Cuffs
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class CuffableSystem : SharedCuffableSystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<CuffableComponent, ComponentGetState>(OnCuffableGetState);
|
|
}
|
|
|
|
private void OnCuffableGetState(Entity<CuffableComponent> entity, ref ComponentGetState args)
|
|
{
|
|
// there are 2 approaches i can think of to handle the handcuff overlay on players
|
|
// 1 - make the current RSI the handcuff type that's currently active. all handcuffs on the player will appear the same.
|
|
// 2 - allow for several different player overlays for each different cuff type.
|
|
// approach #2 would be more difficult/time consuming to do and the payoff doesn't make it worth it.
|
|
// right now we're doing approach #1.
|
|
HandcuffComponent? cuffs = null;
|
|
if (TryGetLastCuff((entity, entity.Comp), out var cuff))
|
|
TryComp(cuff, out cuffs);
|
|
args.State = new CuffableComponentState(entity.Comp.CuffedHandCount,
|
|
entity.Comp.CanStillInteract,
|
|
cuffs?.CuffedRSI,
|
|
$"{cuffs?.BodyIconState}-{entity.Comp.CuffedHandCount}",
|
|
cuffs?.Color);
|
|
// the iconstate is formatted as blah-2, blah-4, blah-6, etc.
|
|
// the number corresponds to how many hands are cuffed.
|
|
}
|
|
}
|
|
}
|