]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix 0-length climbs (#21224)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Tue, 24 Oct 2023 10:44:09 +0000 (21:44 +1100)
committerGitHub <noreply@github.com>
Tue, 24 Oct 2023 10:44:09 +0000 (21:44 +1100)
Content.Shared/Climbing/Systems/ClimbSystem.cs

index 511149f8f9502f99ae2ee6e418c3e8b3d0dae6c5..46255e4337664b67247959ba1f7438aaecfe4252 100644 (file)
@@ -257,15 +257,25 @@ public sealed partial class ClimbSystem : VirtualController
          // Need direction relative to climber's parent.
          var localDirection = (-parentRot).RotateVec(worldDirection);
 
-         climbing.IsClimbing = true;
-         var climbDuration = TimeSpan.FromSeconds(distance / climbing.TransitionRate);
-         climbing.NextTransition = _timing.CurTime + climbDuration;
+         // On top of it already so just do it in place.
+         if (localDirection.LengthSquared() < 0.01f)
+         {
+             climbing.NextTransition = null;
+         }
+         // VirtualController over to the thing.
+         else
+         {
+             var climbDuration = TimeSpan.FromSeconds(distance / climbing.TransitionRate);
+             climbing.NextTransition = _timing.CurTime + climbDuration;
+
+             climbing.Direction = localDirection.Normalized() * climbing.TransitionRate;
+             _actionBlockerSystem.UpdateCanMove(uid);
+         }
 
-         climbing.Direction = localDirection.Normalized() * climbing.TransitionRate;
+         climbing.IsClimbing = true;
          Dirty(uid, climbing);
 
          _audio.PlayPredicted(comp.FinishClimbSound, climbable, user);
-         _actionBlockerSystem.UpdateCanMove(uid);
 
          var startEv = new StartClimbEvent(climbable);
          var climbedEv = new ClimbedOnEvent(uid, user);