From 5bb9e762665ce1c9596699f85ba09d4c8d2d5529 Mon Sep 17 00:00:00 2001 From: xiangwang Date: Fri, 18 Sep 2026 01:53:28 +0800 Subject: [PATCH] fix: route world NPCs around the west plaza street lamp Move the western transit point left to clear the lamp with the largest NPC footprint. Document source-based frontend collision verification and allow Jest to run from a clean checkout without the optional local test directory. --- jest.config.js | 6 +++++- src/business/world_npc/README.md | 12 ++++++++++++ src/business/world_npc/world_npc.world.ts | 4 +++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/jest.config.js b/jest.config.js index 277667a..39d13f2 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,7 +1,11 @@ +const { existsSync } = require('node:fs'); +const { join } = require('node:path'); + module.exports = { preset: 'ts-jest', moduleFileExtensions: ['js', 'json', 'ts'], - roots: ['/src', '/test'], + // The optional local integration tests are not part of a clean checkout. + roots: ['/src', ...(existsSync(join(__dirname, 'test')) ? ['/test'] : [])], testRegex: '.*\\.(spec|e2e-spec|integration-spec|perf-spec)\\.ts$', transform: { '^.+\\.ts$': 'ts-jest', diff --git a/src/business/world_npc/README.md b/src/business/world_npc/README.md index a6088fd..c2d9063 100644 --- a/src/business/world_npc/README.md +++ b/src/business/world_npc/README.md @@ -72,3 +72,15 @@ Godot verification from `whale-town-front-v2`: /Applications/Godot.app/Contents/MacOS/Godot --headless --path . --scene tools/square_npc_test.tscn /Applications/Godot.app/Contents/MacOS/Godot --headless --path . --script tools/smoke_ai_town_maps.gd ``` + +Check the backend's current route graph against the frontend's real collision +shapes from `whale-town-front-v2` (both repositories and backend dependencies are +required): + +```bash +sh scripts/check_world_npc_navigation.sh ../whale-town-end-v2 +``` + +The script exports directly from TypeScript, then checks NPC standing positions +and walk segments using the largest NPC footprint. Set `GODOT_BIN` when Godot +is installed outside `/Applications/Godot.app/Contents/MacOS/Godot`. diff --git a/src/business/world_npc/world_npc.world.ts b/src/business/world_npc/world_npc.world.ts index 2a84925..f54c9b9 100644 --- a/src/business/world_npc/world_npc.world.ts +++ b/src/business/world_npc/world_npc.world.ts @@ -40,7 +40,9 @@ export const WORLD_LOCATIONS: readonly WorldLocation[] = [ }, { id: 'square_northwest_walkway', mapId: 'whale_port', name: '广场西北步道', x: -380, y: -380, tags: ['transit'] }, { id: 'square_north_walkway', mapId: 'whale_port', name: '广场北侧步道', x: 0, y: -380, tags: ['transit'] }, - { id: 'square_west_walkway', mapId: 'whale_port', name: '喷泉西侧步道', x: -380, y: 250, tags: ['transit'] }, + // Stay west of the PlazaLeft lamp at (-335, 275), including the 60px NPC + // footprint, before turning toward the lower approach at (-340, 470). + { id: 'square_west_walkway', mapId: 'whale_port', name: '喷泉西侧步道', x: -400, y: 250, tags: ['transit'] }, { id: 'square_dock_inland_approach', mapId: 'whale_port', name: '码头内侧通道', x: -500, y: 400, tags: ['transit'] }, { id: 'square_west_lower_approach', mapId: 'whale_port', name: '广场西侧下行通道', x: -340, y: 470, tags: ['transit'] }, { id: 'square_south_walkway', mapId: 'whale_port', name: '广场南侧步道', x: -360, y: 650, tags: ['transit'] },