]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix puller being improperly unset when pulling stops. (#26312)
authornikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com>
Fri, 22 Mar 2024 01:59:18 +0000 (03:59 +0200)
committerGitHub <noreply@github.com>
Fri, 22 Mar 2024 01:59:18 +0000 (12:59 +1100)
Fix puller not being improperly unset on PullableComponent while being unpulled.

When unpulled, the pullableComp has its puller field set to null after the message signifying the pulling has stopped
has been sent. Since the component has a field to determine whether its owner is being pulled which is determined by
the puller field, systems listening on the event would think that the owner of the component was still being pulled.

Content.Shared/Movement/Pulling/Systems/PullingSystem.cs

index 33794ba169ead112bc1e73dfcea48cce6d37012b..b347c6da1644ef997933e7af19d8ab660843e692 100644 (file)
@@ -201,13 +201,18 @@ public sealed class PullingSystem : EntitySystem
             }
         }
 
+        var oldPuller = pullableComp.Puller;
+        pullableComp.PullJointId = null;
+        pullableComp.Puller = null;
+        Dirty(pullableUid, pullableComp);
+
         // No more joints with puller -> force stop pull.
-        if (TryComp<PullerComponent>(pullableComp.Puller, out var pullerComp))
+        if (TryComp<PullerComponent>(oldPuller, out var pullerComp))
         {
-            var pullerUid = pullableComp.Puller.Value;
+            var pullerUid = oldPuller.Value;
             _alertsSystem.ClearAlert(pullerUid, AlertType.Pulling);
             pullerComp.Pulling = null;
-            Dirty(pullableComp.Puller.Value, pullerComp);
+            Dirty(oldPuller.Value, pullerComp);
 
             // Messaging
             var message = new PullStoppedMessage(pullerUid, pullableUid);
@@ -218,9 +223,6 @@ public sealed class PullingSystem : EntitySystem
             RaiseLocalEvent(pullableUid, message);
         }
 
-        pullableComp.PullJointId = null;
-        pullableComp.Puller = null;
-        Dirty(pullableUid, pullableComp);
 
         _alertsSystem.ClearAlert(pullableUid, AlertType.Pulled);
     }