Move piano recording keys to Z/X/C and keep control errors out of chat
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user