From 3d59f880b289b63c3c501d9d9e732a7370be945c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Pasteau?= <4895034+ClementPasteau@users.noreply.github.com> Date: Wed, 7 Oct 2026 11:30:33 +0200 Subject: [PATCH] Fix test --- .../starting-point-and-click-adventure.json | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/starting-point-and-click-adventure/starting-point-and-click-adventure.json b/examples/starting-point-and-click-adventure/starting-point-and-click-adventure.json index 56ffe5932..8801c2217 100644 --- a/examples/starting-point-and-click-adventure/starting-point-and-click-adventure.json +++ b/examples/starting-point-and-click-adventure/starting-point-and-click-adventure.json @@ -1833,31 +1833,31 @@ " );", "", "// Click on a spot with no NPC on it: clicking an NPC talks to it instead of", - "// just walking. The NPCs are wide, so the candidates are tried in turn.", + "// just walking. The NPCs are wide and the room has walls the pathfinder keeps", + "// the player away from, so the candidates are tried in turn until one is", + "// both free of NPCs and reachable. They are all far enough for the walk", + "// below to be measurable.", "let destinationX = null;", "let destinationY = null;", - "for (const [dx, dy] of [[90, 300], [-90, 300], [200, 250], [90, -230]]) {", - " if (destinationX === null && isClearOfNPCs(start.centerX + dx, start.centerY + dy)) {", - " destinationX = start.centerX + dx;", - " destinationY = start.centerY + dy;", + "for (const [dx, dy] of [[200, 250], [90, 300], [-90, 300], [90, -230], [150, 0], [-150, 0], [0, 150]]) {", + " const x = start.centerX + dx;", + " const y = start.centerY + dy;", + " if (!isClearOfNPCs(x, y)) continue;", + " await clickAt(x, y, start.layer);", + " console.log(", + " 'clicked=' + Math.round(x) + ',' + Math.round(y) +", + " ' pathFound=' + pathfinding().PathFound +", + " ' nodes=' + pathfinding().NodeCount", + " );", + " if (pathfinding().PathFound === true) {", + " destinationX = x;", + " destinationY = y;", + " break;", " }", "}", "harness.assert(", " destinationX !== null,", - " 'There is a spot to walk to with no NPC standing on it.'", - ");", - "await clickAt(destinationX, destinationY, start.layer);", - "", - "console.log(", - " 'destinationAsked=' + Math.round(destinationX) + ',' + Math.round(destinationY) +", - " ' pathFound=' + pathfinding().PathFound +", - " ' destinationSet=' + Math.round(pathfinding().DestinationX) + ',' +", - " Math.round(pathfinding().DestinationY)", - ");", - "harness.assert(", - " pathfinding().PathFound === true,", - " 'Clicking gives the player a path to walk (it found ' +", - " pathfinding().NodeCount + ' node(s)).'", + " 'Clicking a free spot gives the player a path to walk.'", ");", "", "const walked = await harness.stepUntil(",