Fix pull not stopping when character is downed (#27796)

This commit is contained in:
ShadowCommander
2024-05-07 23:49:28 -07:00
committed by GitHub
parent 1a09374b01
commit 83099640e6

View File

@@ -13,6 +13,7 @@ using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Pulling.Events;
using Content.Shared.Movement.Systems;
using Content.Shared.Pulling.Events;
using Content.Shared.Standing;
using Content.Shared.Throwing;
using Content.Shared.Verbs;
using Robust.Shared.Containers;
@@ -62,6 +63,7 @@ public sealed class PullingSystem : EntitySystem
SubscribeLocalEvent<PullerComponent, EntityUnpausedEvent>(OnPullerUnpaused);
SubscribeLocalEvent<PullerComponent, VirtualItemDeletedEvent>(OnVirtualItemDeleted);
SubscribeLocalEvent<PullerComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
SubscribeLocalEvent<PullerComponent, DropHandItemsEvent>(OnDropHandItems);
CommandBinds.Builder
.Bind(ContentKeyFunctions.MovePulledObject, new PointerInputCmdHandler(OnRequestMovePulledObject))
@@ -69,6 +71,17 @@ public sealed class PullingSystem : EntitySystem
.Register<PullingSystem>();
}
private void OnDropHandItems(EntityUid uid, PullerComponent pullerComp, DropHandItemsEvent args)
{
if (pullerComp.Pulling == null || pullerComp.NeedsHands)
return;
if (!TryComp(pullerComp.Pulling, out PullableComponent? pullableComp))
return;
TryStopPull(pullerComp.Pulling.Value, pullableComp, uid);
}
private void OnPullerContainerInsert(Entity<PullerComponent> ent, ref EntGotInsertedIntoContainerMessage args)
{
if (ent.Comp.Pulling == null) return;