Retractable items get removed by handcuffs (#38441)

* init

* oops

* happens

* review

* fix
This commit is contained in:
ScarKy0
2025-06-22 02:24:12 +02:00
committed by GitHub
parent 6a582db4b8
commit 2e90bc7b6d
3 changed files with 65 additions and 15 deletions

View File

@@ -15,6 +15,7 @@ using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Components;
using Content.Shared.Interaction.Events;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Content.Shared.Inventory.VirtualItem;
using Content.Shared.Item;
@@ -472,6 +473,9 @@ namespace Content.Shared.Cuffs
if (TryComp<HandsComponent>(target, out var hands) && hands.Count <= component.CuffedHandCount)
return false;
var ev = new TargetHandcuffedEvent();
RaiseLocalEvent(target, ref ev);
// Success!
_hands.TryDrop(user, handcuff);
@@ -807,15 +811,24 @@ namespace Content.Shared.Cuffs
{
return component.Container.ContainedEntities;
}
}
[Serializable, NetSerializable]
private sealed partial class UnCuffDoAfterEvent : SimpleDoAfterEvent
{
}
[Serializable, NetSerializable]
public sealed partial class UnCuffDoAfterEvent : SimpleDoAfterEvent;
[Serializable, NetSerializable]
private sealed partial class AddCuffDoAfterEvent : SimpleDoAfterEvent
{
}
[Serializable, NetSerializable]
public sealed partial class AddCuffDoAfterEvent : SimpleDoAfterEvent;
/// <summary>
/// Raised on the target when they get handcuffed.
/// Relayed to their held items.
/// </summary>
[ByRefEvent]
public record struct TargetHandcuffedEvent : IInventoryRelayEvent
{
/// <summary>
/// All slots to relay to
/// </summary>
public SlotFlags TargetSlots { get; set; }
}
}