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 } }