throw an exception if no path found when using player.moveTo command. Cancelling path following no longer rejects the promise

This commit is contained in:
Hanusiak Piotr 2022-01-19 17:22:28 +01:00
parent ef02a06ad7
commit 62b00f852d
6 changed files with 26 additions and 26 deletions

View file

@ -1467,6 +1467,9 @@ ${escapedMessage}
const startTile = this.getGameMap().getTileIndexAt(this.CurrentPlayer.x, this.CurrentPlayer.y);
const path = await this.getPathfindingManager().findPath(startTile, index, true, true);
path.shift();
if (path.length === 0) {
throw new Error("no path available");
}
return this.CurrentPlayer.setPathToFollow(path, message.speed);
});
}