Fix for can't stop pulling when cuffed (#40233)
* fix * fix * spaces added
This commit is contained in:
@@ -477,14 +477,16 @@ namespace Content.Shared.Cuffs
|
|||||||
if (TryComp<HandsComponent>(target, out var hands) && hands.Count <= component.CuffedHandCount)
|
if (TryComp<HandsComponent>(target, out var hands) && hands.Count <= component.CuffedHandCount)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var ev = new TargetHandcuffedEvent();
|
|
||||||
RaiseLocalEvent(target, ref ev);
|
|
||||||
|
|
||||||
// Success!
|
// Success!
|
||||||
_hands.TryDrop(user, handcuff);
|
_hands.TryDrop(user, handcuff);
|
||||||
|
|
||||||
_container.Insert(handcuff, component.Container);
|
_container.Insert(handcuff, component.Container);
|
||||||
|
|
||||||
|
var ev = new TargetHandcuffedEvent();
|
||||||
|
RaiseLocalEvent(target, ref ev);
|
||||||
|
|
||||||
UpdateHeldItems(target, handcuff, component);
|
UpdateHeldItems(target, handcuff, component);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.ActionBlocker;
|
|||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.Buckle.Components;
|
using Content.Shared.Buckle.Components;
|
||||||
|
using Content.Shared.Cuffs;
|
||||||
using Content.Shared.Cuffs.Components;
|
using Content.Shared.Cuffs.Components;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Hands;
|
using Content.Shared.Hands;
|
||||||
@@ -82,12 +83,30 @@ public sealed class PullingSystem : EntitySystem
|
|||||||
|
|
||||||
SubscribeLocalEvent<PullableComponent, StrappedEvent>(OnBuckled);
|
SubscribeLocalEvent<PullableComponent, StrappedEvent>(OnBuckled);
|
||||||
SubscribeLocalEvent<PullableComponent, BuckledEvent>(OnGotBuckled);
|
SubscribeLocalEvent<PullableComponent, BuckledEvent>(OnGotBuckled);
|
||||||
|
SubscribeLocalEvent<ActivePullerComponent, TargetHandcuffedEvent>(OnTargetHandcuffed);
|
||||||
|
|
||||||
CommandBinds.Builder
|
CommandBinds.Builder
|
||||||
.Bind(ContentKeyFunctions.ReleasePulledObject, InputCmdHandler.FromDelegate(OnReleasePulledObject, handle: false))
|
.Bind(ContentKeyFunctions.ReleasePulledObject, InputCmdHandler.FromDelegate(OnReleasePulledObject, handle: false))
|
||||||
.Register<PullingSystem>();
|
.Register<PullingSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnTargetHandcuffed(Entity<ActivePullerComponent> ent, ref TargetHandcuffedEvent args)
|
||||||
|
{
|
||||||
|
if (!TryComp<PullerComponent>(ent, out var comp))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (comp.Pulling == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (CanPull(ent, comp.Pulling.Value, comp))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!TryComp<PullableComponent>(comp.Pulling, out var pullableComp))
|
||||||
|
return;
|
||||||
|
|
||||||
|
TryStopPull(comp.Pulling.Value, pullableComp);
|
||||||
|
}
|
||||||
|
|
||||||
private void HandlePullStarted(EntityUid uid, HandsComponent component, PullStartedMessage args)
|
private void HandlePullStarted(EntityUid uid, HandsComponent component, PullStartedMessage args)
|
||||||
{
|
{
|
||||||
if (args.PullerUid != uid)
|
if (args.PullerUid != uid)
|
||||||
@@ -579,9 +598,6 @@ public sealed class PullingSystem : EntitySystem
|
|||||||
if (pullerUidNull == null)
|
if (pullerUidNull == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (user != null && !_blocker.CanInteract(user.Value, pullableUid))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
var msg = new AttemptStopPullingEvent(user);
|
var msg = new AttemptStopPullingEvent(user);
|
||||||
RaiseLocalEvent(pullableUid, msg, true);
|
RaiseLocalEvent(pullableUid, msg, true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user