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 <plykiya@protonmail.com>
This commit is contained in:
Plykiya
2024-07-03 18:29:07 -07:00
committed by GitHub
parent 143151f284
commit 48ae8ce0a8

View 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);