Undid previous change, updated to instead check the next and the next_next block

This commit is contained in:
Echocage 2022-06-27 18:38:54 -05:00
parent 2741fc2683
commit 57c4f9e103

View File

@ -385,7 +385,7 @@ public class PathExecutor implements IPathExecutor, Helper {
return false;
}
if (pathPosition < path.length() - 2) {
if (pathPosition < path.length() - 3) {
IMovement next = path.movements().get(pathPosition + 1);
if (next instanceof MovementAscend && current.getDirection().up().equals(next.getDirection().down())) {
// a descend then an ascend in the same direction
@ -396,7 +396,8 @@ public class PathExecutor implements IPathExecutor, Helper {
logDebug("Skipping descend to straight ascend");
return true;
}
if (canSprintFromDescendInto(ctx, current, next)) {
if (canSprintFromDescendInto(ctx, current, next) &&
canSprintFromDescendInto(ctx, next, path.movements().get(pathPosition + 2))) {
if (ctx.playerFeet().equals(current.getDest())) {
pathPosition++;
onChangeInPathPosition();
@ -536,12 +537,12 @@ public class PathExecutor implements IPathExecutor, Helper {
}
private static boolean canSprintFromDescendInto(IPlayerContext ctx, IMovement current, IMovement next) {
if (!MovementHelper.canWalkOn(ctx, current.getDest().add(current.getDirection()))) {
return false;
}
if (next instanceof MovementDescend && next.getDirection().equals(current.getDirection())) {
return true;
}
if (!MovementHelper.canWalkOn(ctx, current.getDest().add(current.getDirection()))) {
return false;
}
if (next instanceof MovementTraverse && next.getDirection().down().equals(current.getDirection())) {
return true;
}