From 934913b03957e2c11b269c6ff6f2e9441eceee0a Mon Sep 17 00:00:00 2001 From: metamuffin Date: Thu, 20 Jun 2024 02:27:57 +0200 Subject: include demands in graph --- server/src/bin/graph.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'server/src') diff --git a/server/src/bin/graph.rs b/server/src/bin/graph.rs index 9ff6f973..c52b1400 100644 --- a/server/src/bin/graph.rs +++ b/server/src/bin/graph.rs @@ -13,13 +13,13 @@ fn main() { println!("i{i} [label=\"{}\"]", data.item_name(ItemIndex(i))) } for (RecipeIndex(ri), recipe) in data.recipes() { + let (kind, color) = match recipe { + Recipe::Passive { .. } => ("Passive", "#2bc493"), + Recipe::Active { .. } => ("Active", "#47c42b"), + Recipe::Instant { .. } => ("Instant", "#5452d8"), + }; println!( - "r{ri} [label=\"{}\\non {}\" shape=box color=gray fillcolor=gray style=filled]", - match recipe { - Recipe::Passive { .. } => "Passive", - Recipe::Active { .. } => "Active", - Recipe::Instant { .. } => "Instant", - }, + "r{ri} [label=\"{kind}\\non {}\" shape=box color={color:?} fillcolor={color:?} style=filled]", if let Some(tile) = recipe.tile() { data.tile_name(tile) } else { @@ -34,5 +34,15 @@ fn main() { } } + for (di, d) in data.demands.iter().enumerate() { + let color = "#c4422b"; + println!( + "d{di} [label=\"Demand\\ntakes {}s\" shape=box color={color:?} fillcolor={color:?} style=filled]", + d.duration + ); + println!("i{} -> d{di}", d.from.0); + println!("d{di} -> i{}", d.to.0); + } + println!("}}"); } -- cgit v1.2.3-70-g09d2