blob: 717383d4dd5df4959ba545fd696452e161cf7997 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
export type ID = number;
export type Vec2 = [number, number]
export type Item = string
export type Tile = string
export type PacketS =
{ join: { name: string } }
| "leave"
| { position: { pos: Vec2, rot: number } }
| { interact: { pos: Vec2 } }
export type PacketC =
{ joined: { id: ID } }
| { add_player: { id: ID, name: string, hand?: [number, Item] } }
| { remove_player: { id: ID } }
| { position: { player: ID, pos: Vec2, rot: number } }
| { take_item: { item: ID, player: ID } }
| { put_item: { item: ID, pos: Vec2 } }
| { produce_item: { id: ID, pos: Vec2, kind: Item } }
| { consume_item: { id: ID, pos: Vec2 } }
| { set_active: { tile: Vec2 } }
| { update_map: { pos: Vec2, tile: Tile } }
|