Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(",
Expand Down
Loading