From 48ae8ce0a88d0ecfcb48d22cfa103405ddbd7d63 Mon Sep 17 00:00:00 2001 From: Plykiya <58439124+Plykiya@users.noreply.github.com> Date: Wed, 3 Jul 2024 18:29:07 -0700 Subject: [PATCH] Fixes objects changing physics behavior after being pulled (#29694) * Fixes pull rotation logic * cleaner condition * even less code * I CHANGED MY MIND * first one * second one --------- Co-authored-by: plykiya --- Content.Shared/Movement/Pulling/Systems/PullingSystem.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs b/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs index edc8ad5161..f563440af0 100644 --- a/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs +++ b/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs @@ -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); -- 2.51.2