Initial UI including ingredients in crafting modular components

This commit is contained in:
Sam 2022-03-25 11:09:42 -04:00
parent 085b18c07a
commit a5a517916e
2 changed files with 624 additions and 563 deletions

View File

@ -666,6 +666,17 @@ impl ComponentRecipe {
},
}
}
pub fn inputs(&self) -> impl ExactSizeIterator<Item = (&RecipeInput, u32)> {
let material = core::iter::once(&self.material);
let modifier = self.modifier.iter();
let additional_inputs = self.additional_inputs.iter();
material.chain(modifier.chain(additional_inputs))
.map(|(item_def, amount)| (item_def, *amount))
// Hack, not sure how to get exact size iterator from multiple chains.
.collect::<Vec<_>>()
.into_iter()
}
}
#[derive(Clone, Deserialize)]

File diff suppressed because it is too large Load Diff