diff --git a/Content.Server/Cuffs/CuffableSystem.cs b/Content.Server/Cuffs/CuffableSystem.cs index 2b65803673..b88946105b 100644 --- a/Content.Server/Cuffs/CuffableSystem.cs +++ b/Content.Server/Cuffs/CuffableSystem.cs @@ -2,18 +2,25 @@ using Content.Shared.Cuffs; using JetBrains.Annotations; using Content.Shared.Cuffs.Components; using Robust.Shared.GameStates; +using Content.Shared.Buckle.Components; +using Content.Shared.Hands.Components; +using Robust.Shared.Network; +using Content.Server.Popups; namespace Content.Server.Cuffs { [UsedImplicitly] public sealed class CuffableSystem : SharedCuffableSystem { + [Dependency] private readonly INetManager _netManager = default!; + [Dependency] private readonly PopupSystem _popupSystem = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnHandcuffGetState); SubscribeLocalEvent(OnCuffableGetState); + SubscribeLocalEvent(OnBuckleAttemptEvent); } private void OnHandcuffGetState(EntityUid uid, HandcuffComponent component, ref ComponentGetState args) @@ -39,5 +46,16 @@ namespace Content.Server.Cuffs // the iconstate is formatted as blah-2, blah-4, blah-6, etc. // the number corresponds to how many hands are cuffed. } + + private void OnBuckleAttemptEvent(EntityUid uid, CuffableComponent component, ref BuckleAttemptEvent args) + { + if (TryComp(uid, out var hands) && component.CuffedHandCount == hands.Count) + { + args.Cancelled = true; + var message = Loc.GetString("handcuff-component-cuff-interrupt-buckled-message"); + if (_netManager.IsServer) + _popupSystem.PopupEntity(message, uid); + } + } } } diff --git a/Resources/Locale/en-US/cuffs/components/handcuff-component.ftl b/Resources/Locale/en-US/cuffs/components/handcuff-component.ftl index 8c024f7943..1af80ba228 100644 --- a/Resources/Locale/en-US/cuffs/components/handcuff-component.ftl +++ b/Resources/Locale/en-US/cuffs/components/handcuff-component.ftl @@ -13,3 +13,4 @@ handcuff-component-cuff-self-success-message = You cuff yourself. handcuff-component-cuff-interrupt-message = You were interrupted while cuffing {$targetName}! handcuff-component-cuff-interrupt-other-message = You interrupt {$otherName} while they are cuffing you! handcuff-component-cuff-interrupt-self-message = You were interrupted while cuffing yourself. +handcuff-component-cuff-interrupt-buckled-message = You can't uncuff while buckled!