* DoAfters * Compact Clone() * Fix mice and cuffables * Try generalize attempt events * moves climbabledoafter event to shared, fixes issue with climbable target * Fix merge (cuffing) * Make all events netserializable * handful of doafter events moved * moves the rest of the events to their respective shared folders * Changes all mentions of server doafter to shared * stop stripping cancellation * fix merge errors * draw paused doafters * handle unpausing * missing netserializable ref * removes break on stun reference * removes cuffing state reference * Fix tools * Fix door prying. * Fix construction * Fix dumping * Fix wielding assert * fix rev * Fix test * more test fixes --------- Co-authored-by: keronshb <keronshb@live.com>
44 lines
1.9 KiB
C#
44 lines
1.9 KiB
C#
using Content.Shared.Cuffs;
|
|
using JetBrains.Annotations;
|
|
using Content.Shared.Cuffs.Components;
|
|
using Robust.Shared.GameStates;
|
|
|
|
namespace Content.Server.Cuffs
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class CuffableSystem : SharedCuffableSystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<HandcuffComponent, ComponentGetState>(OnHandcuffGetState);
|
|
SubscribeLocalEvent<CuffableComponent, ComponentGetState>(OnCuffableGetState);
|
|
}
|
|
|
|
private void OnHandcuffGetState(EntityUid uid, HandcuffComponent component, ref ComponentGetState args)
|
|
{
|
|
args.State = new HandcuffComponentState(component.OverlayIconState);
|
|
}
|
|
|
|
private void OnCuffableGetState(EntityUid uid, CuffableComponent component, 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 (component.CuffedHandCount > 0)
|
|
TryComp(component.LastAddedCuffs, out cuffs);
|
|
args.State = new CuffableComponentState(component.CuffedHandCount,
|
|
component.CanStillInteract,
|
|
cuffs?.CuffedRSI,
|
|
$"{cuffs?.OverlayIconState}-{component.CuffedHandCount}",
|
|
cuffs?.Color);
|
|
// the iconstate is formatted as blah-2, blah-4, blah-6, etc.
|
|
// the number corresponds to how many hands are cuffed.
|
|
}
|
|
}
|
|
}
|