diff options
author | metamuffin <metamuffin@disroot.org> | 2025-09-27 17:18:25 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-09-27 17:35:01 +0200 |
commit | 001c0c2e00082a87fb15754003f6b01a1b4fb89d (patch) | |
tree | d6d70017b5064abfb6f58a2ea027e06a8817b3e6 /server/tools/src/recipe_diagram.rs | |
parent | 2e301a9cae6b3944a5e6e32ba8184d31a7bddfba (diff) | |
download | hurrycurry-001c0c2e00082a87fb15754003f6b01a1b4fb89d.tar hurrycurry-001c0c2e00082a87fb15754003f6b01a1b4fb89d.tar.bz2 hurrycurry-001c0c2e00082a87fb15754003f6b01a1b4fb89d.tar.zst |
Less flexible diagram node styles; use rendered item/tile images
Diffstat (limited to 'server/tools/src/recipe_diagram.rs')
-rw-r--r-- | server/tools/src/recipe_diagram.rs | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/server/tools/src/recipe_diagram.rs b/server/tools/src/recipe_diagram.rs index cdc6a942..5a119494 100644 --- a/server/tools/src/recipe_diagram.rs +++ b/server/tools/src/recipe_diagram.rs @@ -19,7 +19,7 @@ use anyhow::Result; use hurrycurry_protocol::{ Gamedata, ItemIndex, Message, Recipe, RecipeIndex, - book::{Diagram, DiagramEdge, DiagramNode}, + book::{Diagram, DiagramEdge, DiagramNode, NodeStyle}, glam::Vec2, }; use hurrycurry_server::data::Serverdata; @@ -84,27 +84,29 @@ pub(crate) fn recipe_diagram( diag.nodes.push(DiagramNode { label: Message::Item(i), position: Vec2::ZERO, - color: None, - shape: None, + style: if target_items.contains(data.item_name(i)) { + NodeStyle::FinalProduct + } else { + NodeStyle::IntermediateProduct + }, }); } for r in recipes { let index = diag.nodes.len(); let recipe = data.recipe(r.index); - let (kind, color) = match recipe { - Recipe::Passive { .. } => ("Passive", "#c4a32b"), - Recipe::Active { .. } => ("Active", "#47c42b"), - Recipe::Instant { .. } => ("Instant", "#5452d8"), + let (kind, style) = match recipe { + Recipe::Passive { .. } => ("Passive", NodeStyle::ProcessPassive), + Recipe::Active { .. } => ("Active", NodeStyle::ProcessActive), + Recipe::Instant { .. } => ("Instant", NodeStyle::ProcessInstant), }; diag.nodes.push(DiagramNode { position: Vec2::ZERO, - label: Message::Text(if let Some(tile) = recipe.tile() { - format!("{kind} on {}", data.tile_name(tile)) + label: if let Some(tile) = recipe.tile() { + Message::Tile(tile) } else { - format!("{kind}") - }), - color: Some(color.to_string()), - shape: Some("box".to_string()), + Message::Text(format!("{kind}")) + }, + style, }); for i in r.inputs { |