aboutsummaryrefslogtreecommitdiff
path: root/test-client/protocol.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-09-25 15:30:09 +0200
committermetamuffin <metamuffin@disroot.org>2024-09-25 15:55:00 +0200
commit9587d6b4d4389f6108e2be0ff5c0f4a495ff842d (patch)
tree3cc2ea9a93de6dd39acd5396fddfbadafef471cf /test-client/protocol.ts
parent64564a25db65d7a578fee537a0cf91db1a7dbc60 (diff)
downloadhurrycurry-9587d6b4d4389f6108e2be0ff5c0f4a495ff842d.tar
hurrycurry-9587d6b4d4389f6108e2be0ff5c0f4a495ff842d.tar.bz2
hurrycurry-9587d6b4d4389f6108e2be0ff5c0f4a495ff842d.tar.zst
player class decoupled from character id
Diffstat (limited to 'test-client/protocol.ts')
-rw-r--r--test-client/protocol.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/test-client/protocol.ts b/test-client/protocol.ts
index 64d740c3..2dcde685 100644
--- a/test-client/protocol.ts
+++ b/test-client/protocol.ts
@@ -36,7 +36,7 @@ export interface Gamedata {
}
export type PacketS =
- { type: "join", name: string, character: number } // Spawns a new character. The server replies with "joined". Dont send it to spectate.
+ { type: "join", name: string, character: number, class: PlayerClass } // Spawns a new character. The server replies with "joined". Dont send it to spectate.
| { type: "leave", player: PlayerID } // Despawns a character
| { type: "movement", player: PlayerID, pos: Vec2, dir: Vec2, boost: boolean }
| { type: "interact", player: PlayerID, pos?: Vec2 } // Interact with some tile. pos is a position when pressing and null when releasing interact button
@@ -48,7 +48,7 @@ export type PacketC =
{ type: "version", minor: number, major: number, supports_bincode?: boolean } // Sent once after connecting to ensure you client is compatible
| { type: "joined", id: PlayerID } // Informs you about the id of the character you spawned
| { type: "data", data: Gamedata } // Game data was changed
- | { type: "add_player", id: PlayerID, name: string, position: Vec2, character: number } // Somebody else joined (or was already in the game)
+ | { type: "add_player", id: PlayerID, name: string, position: Vec2, character: number, class: PlayerClass } // Somebody else joined (or was already in the game)
| { type: "remove_player", id: PlayerID } // Somebody left
| { type: "movement", player: PlayerID, pos: Vec2, rot: number, boost: boolean, dir: Vec2 } // Update the movement of a players (your own position is included here)
| { type: "movement_sync" } // Your movement is difference on the server, you should update your position from a `position` packet
@@ -98,3 +98,5 @@ export type Message =
export type ItemLocation =
{ player: PlayerID }
| { tile: Vec2 }
+
+export type PlayerClass = "chef" | "bot" | "customer"