Adjust footstep volume, wheel reveal timing, and chat hotkey
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
// Maintainer-controlled web client version.
|
||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||
window.CHGRID_WEB_VERSION = "2026.02.21 R70";
|
||||
window.CHGRID_WEB_VERSION = "2026.02.21 R71";
|
||||
|
||||
@@ -114,6 +114,7 @@ const SYSTEM_SOUND_URLS = {
|
||||
notify: withBase('sounds/notify.ogg'),
|
||||
} as const;
|
||||
const FOOTSTEP_SOUND_URLS = Array.from({ length: 11 }, (_, index) => withBase(`sounds/step-${index + 1}.ogg`));
|
||||
const FOOTSTEP_GAIN = 0.7;
|
||||
const WALL_SOUND_URL = withBase('sounds/wall.ogg');
|
||||
|
||||
const state = createInitialState();
|
||||
@@ -805,7 +806,7 @@ function handleMovement(): void {
|
||||
state.player.y = nextY;
|
||||
persistPlayerPosition();
|
||||
state.player.lastMoveTime = now;
|
||||
void audio.playSample(randomFootstepUrl(), 1);
|
||||
void audio.playSample(randomFootstepUrl(), FOOTSTEP_GAIN);
|
||||
signaling.send({ type: 'update_position', x: nextX, y: nextY });
|
||||
|
||||
const namesOnTile = getPeerNamesAtPosition(nextX, nextY);
|
||||
@@ -1049,7 +1050,11 @@ async function onMessage(message: IncomingMessage): Promise<void> {
|
||||
}
|
||||
peerManager.setPeerPosition(message.id, message.x, message.y);
|
||||
if (peer) {
|
||||
void audio.playSpatialSample(randomFootstepUrl(), { x: peer.x - state.player.x, y: peer.y - state.player.y }, 1);
|
||||
void audio.playSpatialSample(
|
||||
randomFootstepUrl(),
|
||||
{ x: peer.x - state.player.x, y: peer.y - state.player.y },
|
||||
FOOTSTEP_GAIN,
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1433,7 +1438,7 @@ function handleNormalModeInput(code: string, shiftKey: boolean): void {
|
||||
return;
|
||||
}
|
||||
|
||||
if (code === 'Quote') {
|
||||
if (code === 'Slash' && !shiftKey) {
|
||||
state.mode = 'chat';
|
||||
state.nicknameInput = '';
|
||||
state.cursorPos = 0;
|
||||
|
||||
@@ -163,6 +163,10 @@ class SignalingServer:
|
||||
)
|
||||
await self._send(client.websocket, packet)
|
||||
|
||||
async def _broadcast_wheel_result_after_delay(self, message: str, delay_seconds: float = 3.0) -> None:
|
||||
await asyncio.sleep(delay_seconds)
|
||||
await self._broadcast(BroadcastChatMessagePacket(type="chat_message", message=message, system=True))
|
||||
|
||||
async def _handle_message(self, client: ClientConnection, raw_message: str) -> None:
|
||||
try:
|
||||
payload = json.loads(raw_message)
|
||||
@@ -418,6 +422,7 @@ class SignalingServer:
|
||||
f"{client.nickname} rolled {item.title}: {', '.join(str(value) for value in rolls)} (total {total})."
|
||||
)
|
||||
self_message = f"You rolled {item.title}: {', '.join(str(value) for value in rolls)} (total {total})."
|
||||
delayed_wheel_result: str | None = None
|
||||
else:
|
||||
spaces_raw = item.params.get("spaces", "")
|
||||
if isinstance(spaces_raw, str):
|
||||
@@ -436,8 +441,9 @@ class SignalingServer:
|
||||
)
|
||||
return
|
||||
landed = random.choice(spaces)
|
||||
others_message = f"{client.nickname} spins {item.title} and it lands on {landed}."
|
||||
others_message = f"{client.nickname} spins {item.title}."
|
||||
self_message = others_message
|
||||
delayed_wheel_result = str(landed)
|
||||
await self._broadcast(
|
||||
BroadcastChatMessagePacket(type="chat_message", message=others_message, system=True),
|
||||
exclude=client.websocket,
|
||||
@@ -453,6 +459,8 @@ class SignalingServer:
|
||||
)
|
||||
)
|
||||
await self._send_item_result(client, True, "use", self_message, item.id)
|
||||
if delayed_wheel_result is not None:
|
||||
asyncio.create_task(self._broadcast_wheel_result_after_delay(delayed_wheel_result))
|
||||
return
|
||||
|
||||
if isinstance(packet, ItemUpdatePacket):
|
||||
|
||||
Reference in New Issue
Block a user