summaryrefslogtreecommitdiff
path: root/test-client/protocol.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-07-02 00:52:42 +0200
committermetamuffin <metamuffin@disroot.org>2024-07-02 00:52:42 +0200
commit8ee3eca5d6de0b950881783821d1be86cd0586d5 (patch)
tree15bfb6fafe9642260fbfcf874f17a2f89afe6b72 /test-client/protocol.ts
parenta57c833665172c83eb449f739073ac36238377c9 (diff)
downloadhurrycurry-8ee3eca5d6de0b950881783821d1be86cd0586d5.tar
hurrycurry-8ee3eca5d6de0b950881783821d1be86cd0586d5.tar.bz2
hurrycurry-8ee3eca5d6de0b950881783821d1be86cd0586d5.tar.zst
generalize protocol
Diffstat (limited to 'test-client/protocol.ts')
-rw-r--r--test-client/protocol.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/test-client/protocol.ts b/test-client/protocol.ts
index 1e76700a..fd0f8d43 100644
--- a/test-client/protocol.ts
+++ b/test-client/protocol.ts
@@ -41,11 +41,9 @@ export type PacketC =
| { 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)
- | { 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: "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: "move_item", from: ItemLocation, to: ItemLocation } // Item moved
+ | { type: "set_item", location: ItemLocation, item?: ItemIndex } // the item contained in a tile or player changed
+ | { type: "set_progress", item: ItemLocation, progress?: number, warn: boolean } // A tile is doing something. progress goes from 0 to 1, then null when finished
| { type: "update_map", tile: Vec2, kind: TileIndex | null, neighbors: [TileIndex | null] } // A map tile was changed
| { type: "communicate", player: PlayerID, message?: Message, persist: boolean } // A player wants to communicate something, message is null when cleared
| { type: "server_message", text: string } // Text message from the server
@@ -57,3 +55,7 @@ export type Message =
{ item: number }
| { text: string }
| { effect: string }
+
+export type ItemLocation =
+ { player: PlayerID }
+ | { tile: Vec2 }