aboutsummaryrefslogtreecommitdiff
path: root/test-client
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-06-17 13:32:18 +0200
committermetamuffin <metamuffin@disroot.org>2024-06-17 13:32:18 +0200
commit5d2bd4a2a6e38d75a5168afc1ef9a6cbcd90ea36 (patch)
treecab52ea116eb19fc2a0a3b2158b2086b6db790a9 /test-client
parent3f23989c2829a4a99349d4670511d71c0f4af8e1 (diff)
downloadhurrycurry-5d2bd4a2a6e38d75a5168afc1ef9a6cbcd90ea36.tar
hurrycurry-5d2bd4a2a6e38d75a5168afc1ef9a6cbcd90ea36.tar.bz2
hurrycurry-5d2bd4a2a6e38d75a5168afc1ef9a6cbcd90ea36.tar.zst
active start / stop
Diffstat (limited to 'test-client')
-rw-r--r--test-client/main.ts6
-rw-r--r--test-client/protocol.ts2
2 files changed, 4 insertions, 4 deletions
diff --git a/test-client/main.ts b/test-client/main.ts
index f31176cd..3e04dc05 100644
--- a/test-client/main.ts
+++ b/test-client/main.ts
@@ -84,7 +84,7 @@ const keys_down = new Set();
const HANDLED_KEYS = ["KeyW", "KeyA", "KeyS", "KeyD", "Space"]
function keyboard(ev: KeyboardEvent, down: boolean) {
if (HANDLED_KEYS.includes(ev.code)) ev.preventDefault()
- if (ev.code == "Space" && down) interact()
+ if (ev.code == "Space") interact(down)
if (down) keys_down.add(ev.code)
else keys_down.delete(ev.code)
}
@@ -98,9 +98,9 @@ function get_interact_target(): V2 | undefined {
}
}
-function interact() {
+function interact(edge: boolean) {
const { x, y } = get_interact_target()!;
- send({ interact: { pos: [x, y] } })
+ send({ interact: { pos: [x, y], edge } })
}
function tick_update() {
diff --git a/test-client/protocol.ts b/test-client/protocol.ts
index 717383d4..707c09a3 100644
--- a/test-client/protocol.ts
+++ b/test-client/protocol.ts
@@ -7,7 +7,7 @@ export type PacketS =
{ join: { name: string } }
| "leave"
| { position: { pos: Vec2, rot: number } }
- | { interact: { pos: Vec2 } }
+ | { interact: { pos: Vec2, edge: boolean } }
export type PacketC =