aboutsummaryrefslogtreecommitdiff
path: root/server/tools/src/recipe_diagram.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/tools/src/recipe_diagram.rs')
-rw-r--r--server/tools/src/recipe_diagram.rs28
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 {