diff --git a/client/public/version.js b/client/public/version.js index 7954242..d1104da 100644 --- a/client/public/version.js +++ b/client/public/version.js @@ -1,5 +1,5 @@ // Maintainer-controlled web client version. // Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) -window.CHGRID_WEB_VERSION = "2026.02.22 R143"; +window.CHGRID_WEB_VERSION = "2026.02.22 R144"; // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid. window.CHGRID_TIME_ZONE = "America/Detroit"; diff --git a/client/src/main.ts b/client/src/main.ts index 6b711a1..b95a3ba 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -172,6 +172,7 @@ const state = createInitialState(); const renderer = new CanvasRenderer(dom.canvas); const audio = new AudioEngine(); let worldGridSize = GRID_SIZE; +let lastWallCollisionDirection: string | null = null; let localStream: MediaStream | null = null; let outboundStream: MediaStream | null = null; let statusTimeout: number | null = null; @@ -900,18 +901,26 @@ function handleMovement(): void { if (state.keysPressed.ArrowLeft) dx = -1; if (state.keysPressed.ArrowRight) dx = 1; - if (dx === 0 && dy === 0) return; + if (dx === 0 && dy === 0) { + lastWallCollisionDirection = null; + return; + } const nextX = state.player.x + dx; const nextY = state.player.y + dy; + const attemptedDirection = `${dx},${dy}`; if (nextX < 0 || nextY < 0 || nextX >= worldGridSize || nextY >= worldGridSize) { state.player.lastMoveTime = now; - void audio.playSample(WALL_SOUND_URL, 1); + if (lastWallCollisionDirection !== attemptedDirection) { + void audio.playSample(WALL_SOUND_URL, 1); + lastWallCollisionDirection = attemptedDirection; + } return; } state.player.x = nextX; state.player.y = nextY; + lastWallCollisionDirection = null; persistPlayerPosition(); state.player.lastMoveTime = now; void audio.playSample(randomFootstepUrl(), FOOTSTEP_GAIN); diff --git a/client/src/state/gameState.ts b/client/src/state/gameState.ts index 0dcd2a4..ecb520e 100644 --- a/client/src/state/gameState.ts +++ b/client/src/state/gameState.ts @@ -1,5 +1,5 @@ export const GRID_SIZE = 41; -export const HEARING_RADIUS = 15; +export const HEARING_RADIUS = 20; export const MOVE_COOLDOWN_MS = 200; export type ItemType = 'radio_station' | 'dice' | 'wheel' | 'clock' | 'widget';