aboutsummaryrefslogtreecommitdiff
path: root/test-client
diff options
context:
space:
mode:
Diffstat (limited to 'test-client')
-rw-r--r--test-client/main.ts5
-rw-r--r--test-client/protocol.ts2
-rw-r--r--test-client/visual.ts2
3 files changed, 6 insertions, 3 deletions
diff --git a/test-client/main.ts b/test-client/main.ts
index eeb9d9c0..9a7e41a4 100644
--- a/test-client/main.ts
+++ b/test-client/main.ts
@@ -43,6 +43,7 @@ export interface ItemData {
y: number,
tracking?: V2,
progress?: number
+ progress_warn?: boolean
remove_anim?: number
}
export interface PlayerData {
@@ -139,7 +140,9 @@ function packet(p: PacketC) {
break;
}
case "set_active": {
- tiles.get(p.tile.toString())!.item!.progress = p.progress
+ const item = tiles.get(p.tile.toString())!.item!;
+ item.progress = p.progress
+ item.progress_warn = p.warn
break;
}
case "update_map":
diff --git a/test-client/protocol.ts b/test-client/protocol.ts
index f075852e..145e08fe 100644
--- a/test-client/protocol.ts
+++ b/test-client/protocol.ts
@@ -26,7 +26,7 @@ export type PacketC =
| { 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 } // A tile is doing something. progress goes from 0 to 1, then null when finished
+ | { 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: "update_map", pos: Vec2, tile: TileIndex, neighbors: [TileIndex | null] } // A map tile was changed
| { type: "communicate", player: PlayerID, message?: Message } // A player wants to communicate something, message is null when cleared
diff --git a/test-client/visual.ts b/test-client/visual.ts
index 4d7468eb..2b98561a 100644
--- a/test-client/visual.ts
+++ b/test-client/visual.ts
@@ -91,7 +91,7 @@ function draw_item(item: ItemData) {
c(ctx)
}
if (item.progress !== null && item.progress !== undefined) {
- ctx.fillStyle = "rgba(115, 230, 58, 0.66)"
+ ctx.fillStyle = item.progress_warn ? "rgba(230, 58, 58, 0.66)" : "rgba(115, 230, 58, 0.66)"
ctx.fillRect(-0.5, -0.5, 1, item.progress)
}
ctx.restore()