diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-03-01 22:08:01 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-03-01 22:08:01 +0100 |
| commit | cec40ee1ec236829e774e3f7f82a17d5d5bffcb0 (patch) | |
| tree | a328291ca1bc258adad81995f5115d150d5b074d /test-client/protocol.ts | |
| parent | 74ffa47147d2bb989057b4513075975c44c2bc42 (diff) | |
| download | hurrycurry-cec40ee1ec236829e774e3f7f82a17d5d5bffcb0.tar hurrycurry-cec40ee1ec236829e774e3f7f82a17d5d5bffcb0.tar.bz2 hurrycurry-cec40ee1ec236829e774e3f7f82a17d5d5bffcb0.tar.zst | |
remove nesting in game/server data packets
Diffstat (limited to 'test-client/protocol.ts')
| -rw-r--r-- | test-client/protocol.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test-client/protocol.ts b/test-client/protocol.ts index 3dfcc594..afec2b41 100644 --- a/test-client/protocol.ts +++ b/test-client/protocol.ts @@ -30,6 +30,12 @@ export interface MapMetadata { difficulty: int, } +export interface Serverdata { + maps: [string, MapMetadata][], // Metadata for most available maps + bot_algos: string[], + name: string, + motd?: string +} export interface Gamedata { current_map: string, item_names: string[], // Look-up table for ItemIndex @@ -38,8 +44,6 @@ export interface Gamedata { tile_placeable_items: { [key: string /*TileIndex*/]: ItemIndex[] }, // Map from TileIndex to list of ItemIndex which can be placed on that tile. Not set if not restricted tile_placeable_any: TileIndex[], tile_interactable_empty: TileIndex[], // List of TileIndex that have "crate recipes" - maps: [string, MapMetadata][], // Metadata for most available maps - bot_algos: string[], hand_count: int, } @@ -58,7 +62,8 @@ export type PacketS = export type PacketC = { type: "version", minor: int, major: int, 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: "game_data" } & Gamedata // Game data was changed + | { type: "server_data" } & Serverdata // Server data was changed | { 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: float, boost: boolean, dir: Vec2 } // Update the movement of a players (your own position is included here) |