From 4dc15a1e86ef1ae985fdf36f1a84d07b1de99ea7 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 25 Jun 2024 23:34:10 +0200 Subject: server can change map at runtime --- test-client/protocol.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test-client/protocol.ts') 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. -- cgit v1.2.3-70-g09d2