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.
This commit is contained in:
2026-09-18 01:53:28 +08:00
parent aaae09399e
commit 5bb9e76266
3 changed files with 20 additions and 2 deletions

View File

@@ -1,7 +1,11 @@
const { existsSync } = require('node:fs');
const { join } = require('node:path');
module.exports = {
preset: 'ts-jest',
moduleFileExtensions: ['js', 'json', 'ts'],
roots: ['<rootDir>/src', '<rootDir>/test'],
// The optional local integration tests are not part of a clean checkout.
roots: ['<rootDir>/src', ...(existsSync(join(__dirname, 'test')) ? ['<rootDir>/test'] : [])],
testRegex: '.*\\.(spec|e2e-spec|integration-spec|perf-spec)\\.ts$',
transform: {
'^.+\\.ts$': 'ts-jest',

View File

@@ -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`.

View File

@@ -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'] },