diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-24 22:17:07 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-24 22:17:07 +0200 |
commit | eb97bd72742009361db232fe45a2ef7656c67998 (patch) | |
tree | 59eb76cb4d078aef6e5a24450cf98be1f5e50cce /test-client | |
parent | 1ecb4a19893d87f17650e5defd6a52ca9df95999 (diff) | |
download | hurrycurry-eb97bd72742009361db232fe45a2ef7656c67998.tar hurrycurry-eb97bd72742009361db232fe45a2ef7656c67998.tar.bz2 hurrycurry-eb97bd72742009361db232fe45a2ef7656c67998.tar.zst |
tc: clean up quick commands
Diffstat (limited to 'test-client')
-rw-r--r-- | test-client/main.ts | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/test-client/main.ts b/test-client/main.ts index 0c96a945..09e1c99a 100644 --- a/test-client/main.ts +++ b/test-client/main.ts @@ -313,6 +313,19 @@ function packet(p: PacketC) { export let chat: null | HTMLInputElement = null; +const QUICK_COMMANDS: { [key: string]: string } = { + "Numpad1": "/start junior", + "Numpad2": "/start senior", + "Numpad3": "/start sophomore", + "Numpad4": "/start debug", + "Numpad5": "/start 5star", + "Numpad6": "/start campaign/lobby", + "Numpad8": "/start-tutorial plate:seared-patty,sliced-bun", + "Numpad9": "/start-tutorial plate:bun", + "Numpad7": "/end-tutorial", + "Numpad0": "/end", +} + export const keys_down = new Set(); function keyboard(ev: KeyboardEvent, down: boolean) { if (down && ev.code == KEY_CHAT) return toggle_chat() @@ -321,16 +334,7 @@ function keyboard(ev: KeyboardEvent, down: boolean) { if (HANDLED_KEYS.includes(ev.code)) ev.preventDefault() if (!keys_down.has(KEY_INTERACT) && ev.code == KEY_INTERACT && down) set_interact(true) if (keys_down.has(KEY_INTERACT) && ev.code == KEY_INTERACT && !down) set_interact(false) - if (down && ev.code == "Numpad1") send({ player: my_id, type: "communicate", message: { text: "/start junior" } }) - if (down && ev.code == "Numpad2") send({ player: my_id, type: "communicate", message: { text: "/start senior" } }) - if (down && ev.code == "Numpad3") send({ player: my_id, type: "communicate", message: { text: "/start sophomore" } }) - if (down && ev.code == "Numpad4") send({ player: my_id, type: "communicate", message: { text: "/start debug" } }) - if (down && ev.code == "Numpad5") send({ player: my_id, type: "communicate", message: { text: "/start 5star" } }) - if (down && ev.code == "Numpad6") send({ player: my_id, type: "communicate", message: { text: "/start campaign/lobby" } }) - if (down && ev.code == "Numpad8") send({ player: my_id, type: "communicate", message: { text: "/start-tutorial plate:seared-patty,sliced-bun" } }) - if (down && ev.code == "Numpad9") send({ player: my_id, type: "communicate", message: { text: "/start-tutorial plate:bun" } }) - if (down && ev.code == "Numpad7") send({ player: my_id, type: "communicate", message: { text: "/end-tutorial" } }) - if (down && ev.code == "Numpad0") send({ player: my_id, type: "communicate", message: { text: "/end" } }) + if (down && ev.code in QUICK_COMMANDS) send({ player: my_id, type: "communicate", message: { text: QUICK_COMMANDS[ev.code] } }) if (down && ev.code == "KeyE") particle_splash(get_interact_target() ?? { x: 0, y: 0 }) if (down) keys_down.add(ev.code) else keys_down.delete(ev.code) |