diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-06-18 19:36:36 +0200 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-06-23 19:21:22 +0200 | 
| commit | 48934ff63ee14d4759eda36512af87361dd915dd (patch) | |
| tree | f7a80115eacfee7b6871040a87f5fb0087098ea8 /test-client/protocol.ts | |
| parent | 6ec47d729509db83eaeb6a9d855ce2483d70f227 (diff) | |
| download | hurrycurry-48934ff63ee14d4759eda36512af87361dd915dd.tar hurrycurry-48934ff63ee14d4759eda36512af87361dd915dd.tar.bz2 hurrycurry-48934ff63ee14d4759eda36512af87361dd915dd.tar.zst | |
remodel game.
Diffstat (limited to 'test-client/protocol.ts')
| -rw-r--r-- | test-client/protocol.ts | 13 | 
1 files changed, 6 insertions, 7 deletions
| diff --git a/test-client/protocol.ts b/test-client/protocol.ts index 96657db7..98fcbf39 100644 --- a/test-client/protocol.ts +++ b/test-client/protocol.ts @@ -1,12 +1,12 @@  export type Vec2 = [number, number] // x, y  export type PlayerID = number -export type ItemID = number  export type ItemIndex = number  export type TileIndex = number  export interface Gamedata {      item_names: string[], // Look-up table for ItemIndex      tile_names: string[], // Look-up table for TileIndex +    spawn: Vec2, // Where players spawn when they join.  }  export type PacketS = @@ -17,13 +17,12 @@ export type PacketS =  export type PacketC =      { type: "init", 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: "add_player", id: PlayerID, name: string, item?: 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: "take_item", tile: Vec2, player: PlayerID }  // An item was taken from a tile +    | { type: "put_item", tile: Vec2, player: PlayerID } // An item was put on a tile +    | { type: "produce_item", tile: Vec2, item: ItemIndex } // A tile generated a new item +    | { type: "consume_item", tile: 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 - | 
