diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-06-18 12:39:55 +0200 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-06-23 19:21:22 +0200 | 
| commit | fb96a40f728137df0566bac8cdb933549a42bfc6 (patch) | |
| tree | a85ad14e220c3b9acafc9b3f0aa1b34484f8cee5 /test-client/protocol.ts | |
| parent | b8b7b5532a9826b7ebd28ae759aa3ff719a43449 (diff) | |
| download | hurrycurry-fb96a40f728137df0566bac8cdb933549a42bfc6.tar hurrycurry-fb96a40f728137df0566bac8cdb933549a42bfc6.tar.bz2 hurrycurry-fb96a40f728137df0566bac8cdb933549a42bfc6.tar.zst | |
changed protocol enums to internally tagged
Diffstat (limited to 'test-client/protocol.ts')
| -rw-r--r-- | test-client/protocol.ts | 28 | 
1 files changed, 14 insertions, 14 deletions
| diff --git a/test-client/protocol.ts b/test-client/protocol.ts index 2dd18b4d..520709fb 100644 --- a/test-client/protocol.ts +++ b/test-client/protocol.ts @@ -10,20 +10,20 @@ export interface Gamedata {  }  export type PacketS = -    { join: { name: string } } // You join, sent as first packet. -    | { position: { pos: Vec2, rot: number } } // Update your position and rotation in radians (0 is -y) -    | { interact: { pos: Vec2, edge: boolean } } // Interact with some tile. edge is true when pressing and false when releasing interact button -    | { collide: { player: PlayerID, force: Vec2 } } // Apply force to another player as a result of a collision +    { type: "join", name: string } // 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: "collide", player: PlayerID, force: Vec2 } // Apply force to another player as a result of a collision  export type PacketC = -    { joined: { id: PlayerID, data: Gamedata } } // You joined -    | { add_player: { id: PlayerID, name: string, hand?: [ItemID, ItemIndex] } } // Somebody else joined (or was already in the game) -    | { remove_player: { id: PlayerID } }  // Somebody left -    | { position: { player: PlayerID, pos: Vec2, rot: number } } // Update the position of a players (your own position is included here) -    | { take_item: { item: ItemID, player: PlayerID } }  // An item was taken from a tile -    | { put_item: { item: ItemID, pos: Vec2 } } // An item was put on a tile -    | { produce_item: { id: ItemID, pos: Vec2, kind: ItemIndex } } // A tile generated a new item -    | { consume_item: { id: ItemID, pos: Vec2 } } // A tile removed an item -    | { set_active: { tile: Vec2, progress?: number } } // A tile is doing something. progress goes from 0 to 1, then null when finished -    | { update_map: { pos: Vec2, tile: TileIndex } } // A map tile was changed +    { type: "joined", id: PlayerID, data: Gamedata } // You joined +    | { type: "add_player", id: PlayerID, name: string, hand?: [ItemID, ItemIndex] } // 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) +    | { type: "take_item", item: ItemID, player: PlayerID }  // An item was taken from a tile +    | { type: "put_item", item: ItemID, pos: Vec2 } // An item was put on a tile +    | { type: "produce_item", id: ItemID, pos: Vec2, kind: ItemIndex } // A tile generated a new item +    | { type: "consume_item", id: ItemID, pos: Vec2 } // A tile removed an item +    | { type: "set_active", tile: Vec2, progress?: number } // A tile is doing something. progress goes from 0 to 1, then null when finished +    | { type: "update_map", pos: Vec2, tile: TileIndex } // A map tile was changed | 
