summaryrefslogtreecommitdiff
path: root/test-client/protocol.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-07-20 19:29:41 +0200
committermetamuffin <metamuffin@disroot.org>2024-07-20 19:29:41 +0200
commit1a45b0e0f5de785ddf268d7371f0cdaeafe9daa7 (patch)
tree5712d2d0784da660733e41d1b69636127b71c3b3 /test-client/protocol.ts
parent89ba8a6b62b90ac72547e2ca9ea5eeae7bbc6500 (diff)
downloadhurrycurry-1a45b0e0f5de785ddf268d7371f0cdaeafe9daa7.tar
hurrycurry-1a45b0e0f5de785ddf268d7371f0cdaeafe9daa7.tar.bz2
hurrycurry-1a45b0e0f5de785ddf268d7371f0cdaeafe9daa7.tar.zst
refactor score code (and break things)
Diffstat (limited to 'test-client/protocol.ts')
-rw-r--r--test-client/protocol.ts18
1 files changed, 17 insertions, 1 deletions
diff --git a/test-client/protocol.ts b/test-client/protocol.ts
index 2a0f2b87..940c8cdc 100644
--- a/test-client/protocol.ts
+++ b/test-client/protocol.ts
@@ -56,10 +56,26 @@ export type PacketC =
| { type: "update_map", tile: Vec2, kind: TileIndex | null, neighbors: [TileIndex | null] } // A map tile was changed
| { type: "communicate", player: PlayerID, message?: Message, persist: boolean } // A player wants to communicate something, message is null when cleared
| { type: "server_message", text: string } // Text message from the server
- | { type: "score", points: number, demands_failed: number, demands_completed: number, time_remaining?: number } // Supplies information for score OSD
+ | { type: "score" } & Score // Supplies information for score OSD
+ | { type: "menu" } & Menu // Open a menu on the client-side
| { type: "set_ingame", state: boolean, lobby: boolean } // Set to false when entering the game or switching maps
| { type: "error", message: string } // Your client did something wrong.
+export type Menu =
+ { menu: "book" }
+ | { menu: "score" } & Score
+
+export interface Score {
+ points: number,
+ demands_failed: number,
+ demands_completed: number,
+ time_remaining: number,
+ players: number,
+ active_recipes: number,
+ passive_recipes: number,
+ instant_recipes: number,
+}
+
export type Message =
{ item: number }
| { text: string }