Cuffable/Handcuff ECS (#14382)

This commit is contained in:
Nemanja
2023-03-13 19:34:26 -04:00
committed by GitHub
parent 59bf67ec8c
commit 49f7575298
25 changed files with 947 additions and 933 deletions

View File

@@ -1,4 +1,4 @@
using Content.Server.Cuffs.Components;
using System.Linq;
using Content.Server.DoAfter;
using Content.Server.Ensnaring;
using Content.Server.Hands.Components;
@@ -14,6 +14,8 @@ using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using System.Threading;
using Content.Server.Administration.Logs;
using Content.Shared.Cuffs;
using Content.Shared.Cuffs.Components;
using Content.Shared.Database;
using Content.Shared.DoAfter;
using Content.Shared.Ensnaring.Components;
@@ -25,6 +27,7 @@ namespace Content.Server.Strip
{
public sealed class StrippableSystem : SharedStrippableSystem
{
[Dependency] private readonly SharedCuffableSystem _cuffable = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
@@ -95,9 +98,9 @@ namespace Content.Server.Strip
// is the target a handcuff?
if (TryComp(hand.HeldEntity, out HandVirtualItemComponent? virt)
&& TryComp(target, out CuffableComponent? cuff)
&& cuff.Container.Contains(virt.BlockingEntity))
&& _cuffable.GetAllCuffs(cuff).Contains(virt.BlockingEntity))
{
cuff.TryUncuff(user, virt.BlockingEntity);
_cuffable.TryUncuff(target, user, virt.BlockingEntity, cuffable: cuff);
return;
}