summaryrefslogtreecommitdiff
path: root/test-client/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test-client/main.ts')
-rw-r--r--test-client/main.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/test-client/main.ts b/test-client/main.ts
index 6622d37f..3926dffc 100644
--- a/test-client/main.ts
+++ b/test-client/main.ts
@@ -36,7 +36,7 @@ interface PlayerData { x: number; y: number, name: string, rot: number, hand?: I
const players = new Map<PlayerID, PlayerData>()
interface ItemData { kind: ItemIndex, tile?: V2, player?: PlayerID, tracking_player: boolean, x: number, y: number }
const items = new Map<ItemID, ItemData>()
-interface TileData { x: number; y: number, kind: TileIndex, items: ItemID[], active: boolean }
+interface TileData { x: number; y: number, kind: TileIndex, items: ItemID[], active_progress?: number }
const tiles = new Map<string, TileData>()
let data: Gamedata = { item_names: [], tile_names: [] }
@@ -79,9 +79,9 @@ function packet(p: PacketC) {
t.items.splice(t.items.indexOf(p.consume_item.id))
items.delete(p.consume_item.id)
} else if ("set_active" in p) {
- // TODO
+ tiles.get(p.set_active.tile.toString())!.active_progress = p.set_active.progress
} else if ("update_map" in p) {
- tiles.set(p.update_map.pos.toString(), { x: p.update_map.pos[0], y: p.update_map.pos[1], kind: p.update_map.tile, active: false, items: [] })
+ tiles.set(p.update_map.pos.toString(), { x: p.update_map.pos[0], y: p.update_map.pos[1], kind: p.update_map.tile, items: [] })
} else console.warn("unknown packet", p);
}
@@ -197,6 +197,10 @@ function draw_ingame() {
for (const c of comps) {
c(ctx)
}
+ if (tile.active_progress !== null && tile.active_progress !== undefined) {
+ ctx.fillStyle = "rgba(115, 230, 58, 0.66)"
+ ctx.fillRect(0, 0, 1, tile.active_progress)
+ }
ctx.restore()
}