Fix pulling cancelling randomly. (#9982)

This commit is contained in:
Moony
2022-07-23 09:26:06 -05:00
committed by GitHub
parent de9df5386f
commit 5d0e73ed4e

View File

@@ -31,6 +31,9 @@ namespace Content.Server.Physics.Controllers
// Velocity change of -LinearVelocity * frameTime * this // Velocity change of -LinearVelocity * frameTime * this
private const float SettleShutdownMultiplier = 20.0f; 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!; [Dependency] private readonly SharedPullingSystem _pullableSystem = default!;
// TODO: Move this stuff to pullingsystem // TODO: Move this stuff to pullingsystem
@@ -64,6 +67,10 @@ namespace Content.Server.Physics.Controllers
UpdatePulledRotation(uid, pullable.Owner); UpdatePulledRotation(uid, pullable.Owner);
if (args.NewPosition.EntityId == args.OldPosition.EntityId &&
(args.NewPosition.Position - args.OldPosition.Position).LengthSquared < MinimumMovementDistance * MinimumMovementDistance)
return;
if (TryComp<PhysicsComponent>(pullable.Owner, out var physics)) if (TryComp<PhysicsComponent>(pullable.Owner, out var physics))
physics.WakeBody(); physics.WakeBody();