diff options
author | metamuffin <metamuffin@disroot.org> | 2024-06-21 00:12:13 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-06-23 19:24:39 +0200 |
commit | a1f6b4f47e7aca167e71311d55c3e9a18f4cbff7 (patch) | |
tree | b928cf5ae7b8179f029fbd36f46487dedf582fc7 /test-client | |
parent | 10aaa4f56642e30b2886735363eb12dfa88e2b70 (diff) | |
download | hurrycurry-a1f6b4f47e7aca167e71311d55c3e9a18f4cbff7.tar hurrycurry-a1f6b4f47e7aca167e71311d55c3e9a18f4cbff7.tar.bz2 hurrycurry-a1f6b4f47e7aca167e71311d55c3e9a18f4cbff7.tar.zst |
show bad passive recipes in red
Diffstat (limited to 'test-client')
-rw-r--r-- | test-client/main.ts | 5 | ||||
-rw-r--r-- | test-client/protocol.ts | 2 | ||||
-rw-r--r-- | test-client/visual.ts | 2 |
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() |