]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix pull not stopping when character is downed (#27796)
authorShadowCommander <shadowjjt@gmail.com>
Wed, 8 May 2024 06:49:28 +0000 (23:49 -0700)
committerGitHub <noreply@github.com>
Wed, 8 May 2024 06:49:28 +0000 (08:49 +0200)
Content.Shared/Movement/Pulling/Systems/PullingSystem.cs

index 3c265d5a027af6387bab940957db84bdb469af7e..81b2fee5695a269a8ec8bdf33d6e129b805d84f0 100644 (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;