Can't break other people's drags on cuffed people (#8868)

* works on my machine

* speedrun
This commit is contained in:
Rane
2022-06-15 21:10:03 -04:00
committed by GitHub
parent d5630e683d
commit e5bad81ac4
3 changed files with 31 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ using Content.Shared.Item;
using Content.Shared.Movement;
using Content.Shared.Physics.Pull;
using Content.Shared.Pulling.Components;
using Content.Shared.Pulling.Events;
namespace Content.Shared.Cuffs
{
@@ -25,10 +26,20 @@ namespace Content.Shared.Cuffs
SubscribeLocalEvent<SharedCuffableComponent, IsUnequippingAttemptEvent>(OnUnequipAttempt);
SubscribeLocalEvent<SharedCuffableComponent, DropAttemptEvent>(OnDropAttempt);
SubscribeLocalEvent<SharedCuffableComponent, PickupAttemptEvent>(OnPickupAttempt);
SubscribeLocalEvent<SharedCuffableComponent, BeingPulledAttemptEvent>(OnBeingPulledAttempt);
SubscribeLocalEvent<SharedCuffableComponent, PullStartedMessage>(OnPull);
SubscribeLocalEvent<SharedCuffableComponent, PullStoppedMessage>(OnPull);
}
private void OnBeingPulledAttempt(EntityUid uid, SharedCuffableComponent component, BeingPulledAttemptEvent args)
{
if (!TryComp<SharedPullableComponent>(uid, out var pullable))
return;
if (pullable.Puller != null && !component.CanStillInteract) // If we are being pulled already and cuffed, we can't get pulled again.
args.Cancel();
}
private void OnPull(EntityUid uid, SharedCuffableComponent component, PullMessage args)
{
if (!component.CanStillInteract)