Increase hearing radius to 20 and suppress repeated wall-hit sound
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// 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.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ const state = createInitialState();
|
|||||||
const renderer = new CanvasRenderer(dom.canvas);
|
const renderer = new CanvasRenderer(dom.canvas);
|
||||||
const audio = new AudioEngine();
|
const audio = new AudioEngine();
|
||||||
let worldGridSize = GRID_SIZE;
|
let worldGridSize = GRID_SIZE;
|
||||||
|
let lastWallCollisionDirection: string | null = null;
|
||||||
let localStream: MediaStream | null = null;
|
let localStream: MediaStream | null = null;
|
||||||
let outboundStream: MediaStream | null = null;
|
let outboundStream: MediaStream | null = null;
|
||||||
let statusTimeout: number | null = null;
|
let statusTimeout: number | null = null;
|
||||||
@@ -900,18 +901,26 @@ function handleMovement(): void {
|
|||||||
if (state.keysPressed.ArrowLeft) dx = -1;
|
if (state.keysPressed.ArrowLeft) dx = -1;
|
||||||
if (state.keysPressed.ArrowRight) 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 nextX = state.player.x + dx;
|
||||||
const nextY = state.player.y + dy;
|
const nextY = state.player.y + dy;
|
||||||
|
const attemptedDirection = `${dx},${dy}`;
|
||||||
if (nextX < 0 || nextY < 0 || nextX >= worldGridSize || nextY >= worldGridSize) {
|
if (nextX < 0 || nextY < 0 || nextX >= worldGridSize || nextY >= worldGridSize) {
|
||||||
state.player.lastMoveTime = now;
|
state.player.lastMoveTime = now;
|
||||||
void audio.playSample(WALL_SOUND_URL, 1);
|
if (lastWallCollisionDirection !== attemptedDirection) {
|
||||||
|
void audio.playSample(WALL_SOUND_URL, 1);
|
||||||
|
lastWallCollisionDirection = attemptedDirection;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.player.x = nextX;
|
state.player.x = nextX;
|
||||||
state.player.y = nextY;
|
state.player.y = nextY;
|
||||||
|
lastWallCollisionDirection = null;
|
||||||
persistPlayerPosition();
|
persistPlayerPosition();
|
||||||
state.player.lastMoveTime = now;
|
state.player.lastMoveTime = now;
|
||||||
void audio.playSample(randomFootstepUrl(), FOOTSTEP_GAIN);
|
void audio.playSample(randomFootstepUrl(), FOOTSTEP_GAIN);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const GRID_SIZE = 41;
|
export const GRID_SIZE = 41;
|
||||||
export const HEARING_RADIUS = 15;
|
export const HEARING_RADIUS = 20;
|
||||||
export const MOVE_COOLDOWN_MS = 200;
|
export const MOVE_COOLDOWN_MS = 200;
|
||||||
|
|
||||||
export type ItemType = 'radio_station' | 'dice' | 'wheel' | 'clock' | 'widget';
|
export type ItemType = 'radio_station' | 'dice' | 'wheel' | 'clock' | 'widget';
|
||||||
|
|||||||
Reference in New Issue
Block a user