Revert ebd0ee6ccf, which introduced a bug instead of fixing one
This commit is contained in:
+1
-1
@@ -44,7 +44,7 @@ export function findPath(from, to, token, previousWaypoints) {
|
||||
let currentNode = lastNode;
|
||||
while (currentNode) {
|
||||
// TODO Check if the distance doesn't change
|
||||
if (path.length >= 2 && !stepCollidesWithWall(currentNode.node, path[path.length - 2], token)) {
|
||||
if (path.length >= 2 && !stepCollidesWithWall(path[path.length - 2], currentNode.node, token))
|
||||
// Replace last waypoint if the current waypoint leads to a valid path
|
||||
path[path.length - 1] = {x: currentNode.node.x, y: currentNode.node.y};
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user