summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-09-27 00:02:22 +0200
committermetamuffin <metamuffin@disroot.org>2024-09-27 00:02:30 +0200
commit938551ca5ea0aa9c606443f8f45e9907639b8f6e (patch)
treeb2a7165fa29159c3491673d8cb9211ed8728f1f2
parentb4143bf35dce7b7826a44022c7116eb042c9a68e (diff)
downloadhurrycurry-938551ca5ea0aa9c606443f8f45e9907639b8f6e.tar
hurrycurry-938551ca5ea0aa9c606443f8f45e9907639b8f6e.tar.bz2
hurrycurry-938551ca5ea0aa9c606443f8f45e9907639b8f6e.tar.zst
unknown orders
-rw-r--r--server/bot/src/algos/customer.rs6
-rw-r--r--server/src/entity/mod.rs5
-rw-r--r--test-client/tiles.ts15
3 files changed, 24 insertions, 2 deletions
diff --git a/server/bot/src/algos/customer.rs b/server/bot/src/algos/customer.rs
index bab82056..b3b029c3 100644
--- a/server/bot/src/algos/customer.rs
+++ b/server/bot/src/algos/customer.rs
@@ -124,9 +124,13 @@ impl BotAlgo for Customer {
check: 0,
pinned: false,
};
+ let unknown_item = game
+ .data
+ .get_item_by_name("unknown-order")
+ .unwrap_or(game.data.demands[demand.0].input);
BotInput {
extra: vec![PacketS::Communicate {
- message: Some(Message::Item(game.data.demands[demand.0].input)),
+ message: Some(Message::Item(unknown_item)),
timeout: Some(timeout),
player: me,
pin: Some(false),
diff --git a/server/src/entity/mod.rs b/server/src/entity/mod.rs
index 4cbfb50b..15e9b0d8 100644
--- a/server/src/entity/mod.rs
+++ b/server/src/entity/mod.rs
@@ -185,7 +185,10 @@ pub fn construct_entity(
blocker_tile: reg.register_tile("fence".to_string()),
active: true,
}),
- EntityDecl::Customers {} => Box::new(Customers::new()?),
+ EntityDecl::Customers {} => {
+ reg.register_item("unknown-order".to_owned());
+ Box::new(Customers::new()?)
+ }
EntityDecl::EnvironmentEffect(config) => Box::new(EnvironmentEffectController::new(config)),
EntityDecl::Environment(names) => Box::new(EnvironmentController(names)),
})
diff --git a/test-client/tiles.ts b/test-client/tiles.ts
index 86203cb7..d890212f 100644
--- a/test-client/tiles.ts
+++ b/test-client/tiles.ts
@@ -83,6 +83,20 @@ function cross(size: number, stroke: string, stroke_width = 0.05): Component {
c.stroke()
}
}
+function text(s: string): Component {
+ return c => {
+ c.font = "0.8px sans-serif"
+ c.strokeStyle = "#e38242"
+ c.fillStyle = "white"
+ c.lineWidth = 0.05
+ c.textAlign = "center"
+ c.textBaseline = "middle"
+ c.lineJoin = "round"
+ c.lineCap = "round"
+ c.strokeText(s, 0, 0)
+ c.fillText(s, 0, 0)
+ }
+}
function arrange_items(...items: ItemName[]): Component {
return c => {
@@ -150,6 +164,7 @@ const ITEMS: { [key in ItemName]: (c: string[]) => Component } = {
"dirty-plate": () => circle(0.4, "#947a6f", "#d3a187", 0.02),
"mochi-dough": () => circle(0.3, "rgb(172, 162, 151)"),
"rice-flour": () => iref("rice"),
+ "unknown-order": () => text("!"),
"pan": i => c => (circle(0.35, "rgb(29, 29, 29)", "rgb(39, 39, 39)", 0.04)(c), arrange_items(...i)(c)),
"pot": i => c => (circle(0.27, "rgb(29, 29, 29)", "rgb(56, 56, 56)", 0.2)(c), arrange_items(...i)(c)),