Skip to content

Commit

Permalink
Fixes objects changing physics behavior after being pulled (space-wiz…
Browse files Browse the repository at this point in the history
…ards#29694)

* Fixes pull rotation logic

* cleaner condition

* even less code

* I CHANGED MY MIND

* first one

* second one

---------

Co-authored-by: plykiya <[email protected]>
  • Loading branch information
Plykiya and plykiya authored Jul 4, 2024
1 parent 143151f commit 48ae8ce
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Content.Shared/Movement/Pulling/Systems/PullingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public bool IsPulling(EntityUid puller, PullerComponent? component = null)

private void OnReleasePulledObject(ICommonSession? session)
{
if (session?.AttachedEntity is not {Valid: true} player)
if (session?.AttachedEntity is not { Valid: true } player)
{
return;
}
Expand Down Expand Up @@ -447,6 +447,9 @@ public bool TryStartPull(EntityUid pullerUid, EntityUid pullableUid,
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)
{
Expand All @@ -465,8 +468,6 @@ public bool TryStartPull(EntityUid pullerUid, EntityUid pullableUid,
_physics.SetFixedRotation(pullableUid, pullableComp.FixedRotationOnPull, body: pullablePhysics);
}

pullableComp.PrevFixedRotation = pullablePhysics.FixedRotation;

// Messaging
var message = new PullStartedMessage(pullerUid, pullableUid);
_modifierSystem.RefreshMovementSpeedModifiers(pullerUid);
Expand Down

0 comments on commit 48ae8ce

Please sign in to comment.