summaryrefslogtreecommitdiff
path: root/test-client/protocol.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test-client/protocol.ts')
-rw-r--r--test-client/protocol.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/test-client/protocol.ts b/test-client/protocol.ts
index a3302628..1cfdab79 100644
--- a/test-client/protocol.ts
+++ b/test-client/protocol.ts
@@ -37,7 +37,7 @@ export interface Gamedata {
}
export type PacketS =
- { type: "join", name: string, character: number, class: PlayerClass } // Spawns a new character. The server replies with "joined". Dont send it to spectate.
+ { type: "join", name: string, character: Character, class: PlayerClass } // Spawns a new character. The server replies with "joined". Dont send it to spectate.
| { type: "leave", player: PlayerID } // Despawns a character
| { type: "idle", paused: boolean } // Indicates that this player is actively participating in the game right now.
| { type: "movement", player: PlayerID, pos: Vec2, dir: Vec2, boost: boolean }
@@ -50,7 +50,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, class: PlayerClass } // Somebody else joined (or was already in the game)
+ | { type: "add_player", id: PlayerID, name: string, position: Vec2, character: Character, 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
@@ -71,6 +71,12 @@ export type PacketC =
| { type: "set_ingame", state: boolean, lobby: boolean } // Set to false when entering the game or switching maps
| { type: "pause", state: boolean } // Set game paused so clients dont increment timers
+export interface Character {
+ color: number,
+ headwear: number,
+ hairstyle: number
+}
+
export type Menu =
{ menu: "document", data: DocumentElement }
| { menu: "score", data: Score }