Backwards Approach

- Fixed trains acceleration edge case at low speed settings #6348
This commit is contained in:
simibubi 2024-07-25 12:26:23 +02:00
parent 067062ca62
commit 3d84836422

View file

@ -264,9 +264,11 @@ public class Navigation {
double topSpeed = train.maxSpeed(); double topSpeed = train.maxSpeed();
if (targetDistance < 10) { if (targetDistance < 10) {
double target = topSpeed * ((targetDistance) / 10); double maxApproachSpeed = topSpeed * ((targetDistance) / 10);
if (target < Math.abs(train.speed)) { double speedRelativeToStation = train.speed * speedMod;
train.speed += (target - Math.abs(train.speed)) * .5f * speedMod;
if (speedRelativeToStation > maxApproachSpeed) {
train.speed += (maxApproachSpeed - Math.abs(train.speed)) * .5f * speedMod;
return; return;
} }
} }