diff options
Diffstat (limited to 'server/tools/src/recipe_diagram.rs')
-rw-r--r-- | server/tools/src/recipe_diagram.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/server/tools/src/recipe_diagram.rs b/server/tools/src/recipe_diagram.rs index 7dc42c1e..453fedc6 100644 --- a/server/tools/src/recipe_diagram.rs +++ b/server/tools/src/recipe_diagram.rs @@ -18,7 +18,7 @@ use anyhow::Result; use hurrycurry_protocol::{ - Gamedata, ItemIndex, Message, RecipeIndex, + Gamedata, ItemIndex, Message, Recipe, RecipeIndex, book::{Diagram, DiagramEdge, DiagramNode}, glam::Vec2, }; @@ -84,16 +84,31 @@ pub(crate) fn recipe_diagram( diag.nodes.push(DiagramNode { label: Message::Item(i), position: Vec2::ZERO, + color: None, + shape: None, }); } 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"), + }; diag.nodes.push(DiagramNode { position: Vec2::ZERO, - label: Message::Text("blub".to_string()), + label: Message::Text(if let Some(tile) = recipe.tile() { + format!("{kind} on {}", data.tile_name(tile)) + } else { + format!("{kind}") + }), + color: Some(color.to_string()), + shape: Some("box".to_string()), }); for i in r.inputs { + eprintln!("{}", data.item_name(i)); diag.edges.push(DiagramEdge { src: item_index[&i], dst: index, |