From 2459262cefda24034db266bc97e850a2fef5bb5d Mon Sep 17 00:00:00 2001 From: Smile Rex Date: Thu, 22 Jan 2026 17:22:00 +0300 Subject: [PATCH] repl --- src/net/Socket.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/net/Socket.ts b/src/net/Socket.ts index 9d1c5ef..bc735b6 100644 --- a/src/net/Socket.ts +++ b/src/net/Socket.ts @@ -30,13 +30,12 @@ export class GameSocket { this.socket.onmessage = (e) => { const msg = JSON.parse(e.data); - switch (msg.type) { - case "init": - this.playerId = msg.payload.id; - break; - case "input": - this.onState?.(msg.payload); - break; + if (msg.type === "init") { + this.playerId = msg.payload.id; + } + + if (msg.type === "input") { + this.onState?.(msg.payload); } };