diff options
-rw-r--r-- | pixel-client/src/config.rs | 17 | ||||
-rw-r--r-- | test-client/main.ts | 7 | ||||
-rw-r--r-- | test-client/tiles.ts | 4 | ||||
-rw-r--r-- | test-client/visual.ts | 8 |
4 files changed, 30 insertions, 6 deletions
diff --git a/pixel-client/src/config.rs b/pixel-client/src/config.rs index 6d74fbe7..8f051b99 100644 --- a/pixel-client/src/config.rs +++ b/pixel-client/src/config.rs @@ -1,3 +1,20 @@ +/* + Hurry Curry! - a game about cooking + Copyright 2024 metamuffin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, version 3 of the License only. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +*/ use anyhow::{anyhow, Result}; use serde::{Deserialize, Serialize}; use std::{ diff --git a/test-client/main.ts b/test-client/main.ts index 78c20d72..1679ab42 100644 --- a/test-client/main.ts +++ b/test-client/main.ts @@ -300,6 +300,13 @@ export function get_interact_target(): V2 | undefined { function set_interact(edge: boolean) { if (edge) interacting = get_interact_target() + if (edge && interacting) { + const kind = tiles.get([interacting.x, interacting.y].toString())?.kind; + if (kind && data.tile_names[kind] == "book") { + open("https://s.metamuffin.org/static/hurrycurry-1.2/book.pdf") + return + } + } if (interacting) send({ player: my_id, type: "interact", pos: edge ? [interacting.x, interacting.y] : undefined }) if (!edge) interacting = undefined } diff --git a/test-client/tiles.ts b/test-client/tiles.ts index a2b46f59..6bd724f1 100644 --- a/test-client/tiles.ts +++ b/test-client/tiles.ts @@ -112,8 +112,8 @@ const iref = (name: keyof typeof ITEMS): Component => c => ITEMS[name].forEach(f const tref = (name: keyof typeof TILES): Component => c => TILES[name].forEach(f => f(c)) type HelperItemName = "steak" | "milk" | "cooked-rice" | "curry" | "strawberry-icecream" | "strawberry-shake" -type ItemName = HelperItemName | "dirty-plate" | "plate" | "tomato" | "raw-steak" | "flour" | "leek" | "rice" | "fish" | "coconut" | "strawberry" | "foodprocessor" | "flour-foodprocessor" | "dough-foodprocessor" | "dough" | "bread" | "burned" | "bread-slice" | "pot" | "raw-steak-pot" | "steak-pot" | "burned-pot" | "sliced-tomato" | "steak-plate" | "sliced-tomato-plate" | "bread-slice-plate" | "bread-slice-steak-plate" | "bread-slice-sliced-tomato-plate" | "bread-slice-sliced-tomato-steak-plate" | "sliced-tomato-steak-plate" | "tomato-foodprocessor" | "tomato-juice-foodprocessor" | "leek-pot" | "tomato-juice-pot" | "leek-tomato-juice-pot" | "tomato-soup-pot" | "tomato-soup-plate" | "sliced-fish" | "rice-pot" | "cooked-rice-pot" | "nigiri" | "nigiri-plate" | "strawberry-foodprocessor" | "strawberry-puree-foodprocessor" | "coconut-foodprocessor" | "milk-foodprocessor" | "coconut-strawberry-puree-foodprocessor" | "strawberry-shake-foodprocessor" | "milk-strawberry-foodprocessor" | "strawberry-icecream-foodprocessor" | "strawberry-icecream-plate" | "rice-foodprocessor" | "rice-flour-foodprocessor" | "rice-flour-pot" | "mochi-dough-pot" | "strawberry-mochi" | "glass" | "strawberry-shake-glass" | "tomato-juice-glass" | "water-glass" | "milk-pot" | "tomato-pot" | "leek-milk-pot" | "leek-tomato-pot" | "leek-milk-tomato-pot" | "milk-tomato-pot" | "curry-pot" | "cooked-rice-plate" | "curry-plate" | "cooked-rice-curry-plate" -type TileName = "sink" | "conveyor" | "book" | "tomato-crate" | "raw-steak-crate" | "flour-crate" | "leek-crate" | "rice-crate" | "fish-crate" | "coconut-crate" | "strawberry-crate" | "oven" | "cuttingboard" | "stove" | "freezer" | "trash" | "grass" | "tree" | "wall" | "chair" | "floor" | "door" | "counter" | "wall-window" | "table" | "counter-window" | "path" | "lamp" | "street" +export type ItemName = HelperItemName | "dirty-plate" | "plate" | "tomato" | "raw-steak" | "flour" | "leek" | "rice" | "fish" | "coconut" | "strawberry" | "foodprocessor" | "flour-foodprocessor" | "dough-foodprocessor" | "dough" | "bread" | "burned" | "bread-slice" | "pot" | "raw-steak-pot" | "steak-pot" | "burned-pot" | "sliced-tomato" | "steak-plate" | "sliced-tomato-plate" | "bread-slice-plate" | "bread-slice-steak-plate" | "bread-slice-sliced-tomato-plate" | "bread-slice-sliced-tomato-steak-plate" | "sliced-tomato-steak-plate" | "tomato-foodprocessor" | "tomato-juice-foodprocessor" | "leek-pot" | "tomato-juice-pot" | "leek-tomato-juice-pot" | "tomato-soup-pot" | "tomato-soup-plate" | "sliced-fish" | "rice-pot" | "cooked-rice-pot" | "nigiri" | "nigiri-plate" | "strawberry-foodprocessor" | "strawberry-puree-foodprocessor" | "coconut-foodprocessor" | "milk-foodprocessor" | "coconut-strawberry-puree-foodprocessor" | "strawberry-shake-foodprocessor" | "milk-strawberry-foodprocessor" | "strawberry-icecream-foodprocessor" | "strawberry-icecream-plate" | "rice-foodprocessor" | "rice-flour-foodprocessor" | "rice-flour-pot" | "mochi-dough-pot" | "strawberry-mochi" | "glass" | "strawberry-shake-glass" | "tomato-juice-glass" | "water-glass" | "milk-pot" | "tomato-pot" | "leek-milk-pot" | "leek-tomato-pot" | "leek-milk-tomato-pot" | "milk-tomato-pot" | "curry-pot" | "cooked-rice-plate" | "curry-plate" | "cooked-rice-curry-plate" +export type TileName = "sink" | "conveyor" | "book" | "tomato-crate" | "raw-steak-crate" | "flour-crate" | "leek-crate" | "rice-crate" | "fish-crate" | "coconut-crate" | "strawberry-crate" | "oven" | "cuttingboard" | "stove" | "freezer" | "trash" | "grass" | "tree" | "wall" | "chair" | "floor" | "door" | "counter" | "wall-window" | "table" | "counter-window" | "path" | "lamp" | "street" const pot = iref("pot") const plate = iref("plate") diff --git a/test-client/visual.ts b/test-client/visual.ts index a5e603c5..07cfde67 100644 --- a/test-client/visual.ts +++ b/test-client/visual.ts @@ -17,7 +17,7 @@ */ import { ItemData, MessageData, PlayerData, TileData, camera, camera_scale, canvas, ctx, data, demands_completed, demands_failed, get_interact_target, global_message, interact_active_anim, interact_possible_anim, interact_target_anim, items_removed, keys_down, my_id, nametag_scale_anim, players, points, tiles, time_remaining } from "./main.ts"; import { PLAYER_SIZE } from "./movement.ts"; -import { draw_item_sprite, draw_tile_sprite } from "./tiles.ts"; +import { draw_item_sprite, draw_tile_sprite, ItemName, TileName } from "./tiles.ts"; import { V2, ceil_v2, floor_v2 } from "./util.ts"; export function draw_wait(text: string) { @@ -109,7 +109,7 @@ function draw_debug() { function draw_tile(tile: TileData) { ctx.save() ctx.translate(tile.x + 0.5, tile.y + 0.5) - draw_tile_sprite(ctx, data.tile_names[tile.kind]) + draw_tile_sprite(ctx, data.tile_names[tile.kind] as TileName) ctx.restore() } @@ -117,7 +117,7 @@ function draw_item(item: ItemData) { ctx.save() ctx.translate(item.x, item.y) if (item.remove_anim) ctx.scale(1 - item.remove_anim, 1 - item.remove_anim) - draw_item_sprite(ctx, data.item_names[item.kind]) + draw_item_sprite(ctx, data.item_names[item.kind] as ItemName) if (item.progress !== null && item.progress !== undefined) { 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) @@ -220,7 +220,7 @@ function draw_message(m: MessageData) { ctx.fill() ctx.translate(0, -1) - draw_item_sprite(ctx, data.item_names[m.inner.item]) + draw_item_sprite(ctx, data.item_names[m.inner.item] as ItemName) ctx.translate(0, 1) } if ("text" in m.inner) { |