]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Shuttle movement fix (#20498)
authorDoru991 <75124791+Doru991@users.noreply.github.com>
Mon, 25 Sep 2023 18:35:25 +0000 (21:35 +0300)
committerGitHub <noreply@github.com>
Mon, 25 Sep 2023 18:35:25 +0000 (10:35 -0800)
Content.Server/Physics/Controllers/MoverController.cs

index 5c8968dd98463b557b14ba7d262161289759fd10..f69b71447752fb25f8d294b423b033ed2f5d5b54 100644 (file)
@@ -249,8 +249,8 @@ namespace Content.Server.Physics.Controllers
 
             var horizIndex = vel.X > 0 ? 1 : 3; // east else west
             var vertIndex = vel.Y > 0 ? 2 : 0; // north else south
-            var horizComp = MathF.Pow(Vector2.Dot(vel, new (shuttle.BaseLinearThrust[horizIndex] / shuttle.LinearThrust[horizIndex], 0f)), 2);
-            var vertComp = MathF.Pow(Vector2.Dot(vel, new (0f, shuttle.BaseLinearThrust[vertIndex] / shuttle.LinearThrust[vertIndex])), 2);
+            var horizComp = vel.X != 0 ? MathF.Pow(Vector2.Dot(vel, new (shuttle.BaseLinearThrust[horizIndex] / shuttle.LinearThrust[horizIndex], 0f)), 2) : 0;
+            var vertComp = vel.Y != 0 ? MathF.Pow(Vector2.Dot(vel, new (0f, shuttle.BaseLinearThrust[vertIndex] / shuttle.LinearThrust[vertIndex])), 2) : 0;
 
             return shuttle.BaseMaxLinearVelocity * vel * MathF.ReciprocalSqrtEstimate(horizComp + vertComp);
         }