From 5d0e73ed4e0c30f0e05090319f7dbb505ffd65a0 Mon Sep 17 00:00:00 2001 From: Moony Date: Sat, 23 Jul 2022 09:26:06 -0500 Subject: [PATCH] Fix pulling cancelling randomly. (#9982) --- Content.Server/Physics/Controllers/PullController.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Content.Server/Physics/Controllers/PullController.cs b/Content.Server/Physics/Controllers/PullController.cs index b8a7d81040..4254b6cc3d 100644 --- a/Content.Server/Physics/Controllers/PullController.cs +++ b/Content.Server/Physics/Controllers/PullController.cs @@ -31,6 +31,9 @@ namespace Content.Server.Physics.Controllers // Velocity change of -LinearVelocity * frameTime * this private const float SettleShutdownMultiplier = 20.0f; + // How much you must move for the puller movement check to actually hit. + private const float MinimumMovementDistance = 0.005f; + [Dependency] private readonly SharedPullingSystem _pullableSystem = default!; // TODO: Move this stuff to pullingsystem @@ -64,6 +67,10 @@ namespace Content.Server.Physics.Controllers UpdatePulledRotation(uid, pullable.Owner); + if (args.NewPosition.EntityId == args.OldPosition.EntityId && + (args.NewPosition.Position - args.OldPosition.Position).LengthSquared < MinimumMovementDistance * MinimumMovementDistance) + return; + if (TryComp(pullable.Owner, out var physics)) physics.WakeBody();