Fix 0-length climbs (#21224)
This commit is contained in:
@@ -257,15 +257,25 @@ public sealed partial class ClimbSystem : VirtualController
|
|||||||
// Need direction relative to climber's parent.
|
// Need direction relative to climber's parent.
|
||||||
var localDirection = (-parentRot).RotateVec(worldDirection);
|
var localDirection = (-parentRot).RotateVec(worldDirection);
|
||||||
|
|
||||||
climbing.IsClimbing = true;
|
// On top of it already so just do it in place.
|
||||||
var climbDuration = TimeSpan.FromSeconds(distance / climbing.TransitionRate);
|
if (localDirection.LengthSquared() < 0.01f)
|
||||||
climbing.NextTransition = _timing.CurTime + climbDuration;
|
{
|
||||||
|
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;
|
climbing.Direction = localDirection.Normalized() * climbing.TransitionRate;
|
||||||
|
_actionBlockerSystem.UpdateCanMove(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
climbing.IsClimbing = true;
|
||||||
Dirty(uid, climbing);
|
Dirty(uid, climbing);
|
||||||
|
|
||||||
_audio.PlayPredicted(comp.FinishClimbSound, climbable, user);
|
_audio.PlayPredicted(comp.FinishClimbSound, climbable, user);
|
||||||
_actionBlockerSystem.UpdateCanMove(uid);
|
|
||||||
|
|
||||||
var startEv = new StartClimbEvent(climbable);
|
var startEv = new StartClimbEvent(climbable);
|
||||||
var climbedEv = new ClimbedOnEvent(uid, user);
|
var climbedEv = new ClimbedOnEvent(uid, user);
|
||||||
|
|||||||
Reference in New Issue
Block a user