summaryrefslogtreecommitdiff
path: root/test-client/protocol.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-06-25 23:34:10 +0200
committermetamuffin <metamuffin@disroot.org>2024-06-25 23:34:10 +0200
commit4dc15a1e86ef1ae985fdf36f1a84d07b1de99ea7 (patch)
tree6a262cd2be9abee480adda3e367c7f8abf8845d6 /test-client/protocol.ts
parent84c90e84a1e0d6cd2eae36fd8888354b4e23c354 (diff)
downloadhurrycurry-4dc15a1e86ef1ae985fdf36f1a84d07b1de99ea7.tar
hurrycurry-4dc15a1e86ef1ae985fdf36f1a84d07b1de99ea7.tar.bz2
hurrycurry-4dc15a1e86ef1ae985fdf36f1a84d07b1de99ea7.tar.zst
server can change map at runtime
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 48a1cca7..f4ffba01 100644
--- a/test-client/protocol.ts
+++ b/test-client/protocol.ts
@@ -32,10 +32,12 @@ export type PacketS =
{ type: "join", name: string, character: number } // You join, sent as first packet.
| { type: "position", pos: Vec2, rot: number } // Update your position and rotation in radians (0 is -y)
| { type: "interact", pos: Vec2, edge: boolean } // Interact with some tile. edge is true when pressing and false when releasing interact button
+ | { type: "communicate", message: Message } // Send a message
| { type: "collide", player: PlayerID, force: Vec2 } // Apply force to another player as a result of a collision
export type PacketC =
- { type: "init", id: PlayerID, data: Gamedata } // You joined
+ { type: "init", id: PlayerID } // You just connected. This is your id for this session.
+ | { 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: "remove_player", id: PlayerID } // Somebody left
| { type: "position", player: PlayerID, pos: Vec2, rot: number } // Update the position of a players (your own position is included here)
@@ -44,7 +46,7 @@ export type PacketC =
| { type: "set_tile_item", tile: Vec2, item?: ItemIndex } // A tile changed its item
| { type: "set_player_item", player: PlayerID, item?: ItemIndex } // A player changed their item
| { type: "set_active", tile: Vec2, progress?: number, warn: boolean } // A tile is doing something. progress goes from 0 to 1, then null when finished
- | { type: "update_map", pos: Vec2, tile: TileIndex, neighbors: [TileIndex | null] } // A map tile was changed
+ | { type: "update_map", tile: Vec2, kind: TileIndex | null, neighbors: [TileIndex | null] } // A map tile was changed
| { type: "communicate", player: PlayerID, message?: Message } // A player wants to communicate something, message is null when cleared
| { type: "error", message?: Message } // Your client did something wrong.