]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fixes objects changing physics behavior after being pulled (#29694)
authorPlykiya <58439124+Plykiya@users.noreply.github.com>
Thu, 4 Jul 2024 01:29:07 +0000 (18:29 -0700)
committerGitHub <noreply@github.com>
Thu, 4 Jul 2024 01:29:07 +0000 (11:29 +1000)
* Fixes pull rotation logic

* cleaner condition

* even less code

* I CHANGED MY MIND

* first one

* second one

---------

Co-authored-by: plykiya <plykiya@protonmail.com>
Content.Shared/Movement/Pulling/Systems/PullingSystem.cs

index edc8ad516172be6b11985b539105321d3d2ed3c0..f563440af048821022c9ffe9b297f2abff03c21f 100644 (file)
@@ -310,7 +310,7 @@ public sealed class PullingSystem : EntitySystem
 
     private void OnReleasePulledObject(ICommonSession? session)
     {
-        if (session?.AttachedEntity is not {Valid: true} player)
+        if (session?.AttachedEntity is not { Valid: true } player)
         {
             return;
         }
@@ -447,6 +447,9 @@ public sealed class PullingSystem : EntitySystem
         pullerComp.Pulling = pullableUid;
         pullableComp.Puller = pullerUid;
 
+        // store the pulled entity's physics FixedRotation setting in case we change it
+        pullableComp.PrevFixedRotation = pullablePhysics.FixedRotation;
+
         // joint state handling will manage its own state
         if (!_timing.ApplyingState)
         {
@@ -465,8 +468,6 @@ public sealed class PullingSystem : EntitySystem
             _physics.SetFixedRotation(pullableUid, pullableComp.FixedRotationOnPull, body: pullablePhysics);
         }
 
-        pullableComp.PrevFixedRotation = pullablePhysics.FixedRotation;
-
         // Messaging
         var message = new PullStartedMessage(pullerUid, pullableUid);
         _modifierSystem.RefreshMovementSpeedModifiers(pullerUid);