Move piano recording keys to Z/X/C and keep control errors out of chat

This commit is contained in:
Jage9
2026-02-23 00:57:18 -05:00
parent 9477beb345
commit d8b470d389
5 changed files with 23 additions and 12 deletions

View File

@@ -87,7 +87,7 @@
},
{
"keys": "Piano mode",
"description": "When using a piano: 1-9 (and 0 for the 10th slot) changes instrument, -/= changes octave, ASDFGHJKL;' plays C major notes, WETYUOP] plays sharps, comma starts/stops recording, period plays recording, slash stops playback, Escape exits"
"description": "When using a piano: 1-9 (and 0 for the 10th slot) changes instrument, -/= changes octave, ASDFGHJKL;' plays C major notes, WETYUOP] plays sharps, Z starts/stops recording, X plays recording, C stops playback, Escape exits"
}
]
},

View File

@@ -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 R206";
window.CHGRID_WEB_VERSION = "2026.02.22 R207";
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
window.CHGRID_TIME_ZONE = "America/Detroit";

View File

@@ -2414,17 +2414,17 @@ function handlePianoUseModeInput(code: string): void {
stopPianoUseMode(false);
return;
}
if (code === 'Comma') {
if (code === 'KeyZ') {
signaling.send({ type: 'item_piano_recording', itemId, action: 'toggle_record' });
audio.sfxUiBlip();
return;
}
if (code === 'Period') {
if (code === 'KeyX') {
signaling.send({ type: 'item_piano_recording', itemId, action: 'playback' });
audio.sfxUiBlip();
return;
}
if (code === 'Slash') {
if (code === 'KeyC') {
signaling.send({ type: 'item_piano_recording', itemId, action: 'stop_playback' });
audio.sfxUiBlip();
return;

View File

@@ -241,12 +241,18 @@ export function createOnMessageHandler(deps: MessageHandlerDeps): (message: Inco
}
case 'item_action_result': {
const pianoStatusMessages = new Set([
'record',
'play',
'stop',
'No recording saved on this piano.',
'Stop recording before playback.',
'This piano is already recording.',
]);
if (message.ok) {
if (message.action === 'use') {
const pianoStatusLabel =
message.message === 'record' || message.message === 'play' || message.message === 'stop' ? message.message : null;
if (pianoStatusLabel) {
deps.updateStatus(pianoStatusLabel);
if (pianoStatusMessages.has(message.message)) {
deps.updateStatus(message.message);
deps.audioUiBlip();
break;
}
@@ -260,6 +266,11 @@ export function createOnMessageHandler(deps: MessageHandlerDeps): (message: Inco
deps.audioUiConfirm();
}
} else {
if (message.action === 'use' && pianoStatusMessages.has(message.message)) {
deps.updateStatus(message.message);
deps.audioUiCancel();
break;
}
deps.pushChatMessage(message.message);
deps.audioUiCancel();
}