From 59277d8f86e2d9d1747db986f28b87e525473d85 Mon Sep 17 00:00:00 2001 From: 20kdc Date: Sat, 9 Oct 2021 14:49:08 +0100 Subject: [PATCH] Ensure pulling maximum length is at least 1 to avoid errors (#4808) --- .../Pulling/Systems/SharedPullingStateManagementSystem.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs index 1b9ee0639e..2244c1aa7c 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs @@ -108,9 +108,10 @@ namespace Content.Shared.Pulling pullable.PullJoint = _jointSystem.CreateDistanceJoint(pullablePhysics.Owner.Uid, pullerPhysics.Owner.Uid, id:$"pull-joint-{pullablePhysics.Owner.Uid}"); pullable.PullJoint.CollideConnected = false; + // This maximum has to be there because if the object is constrained too closely, the clamping goes backwards and asserts. + pullable.PullJoint.MaxLength = Math.Max(1.0f, length); pullable.PullJoint.Length = length * 0.75f; pullable.PullJoint.MinLength = 0f; - pullable.PullJoint.MaxLength = length; pullable.PullJoint.Stiffness = 1f; // Messaging