mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added search filtering to modular entries in crafting UI
This commit is contained in:
@ -598,15 +598,33 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
})
|
})
|
||||||
.chain(
|
.chain(
|
||||||
matches!(sel_crafting_tab, CraftingTab::Weapon | CraftingTab::All)
|
matches!(sel_crafting_tab, CraftingTab::Weapon | CraftingTab::All)
|
||||||
.then_some(modular_entries.iter().map(|(recipe_name, (recipe, _))| {
|
.then_some(
|
||||||
(
|
modular_entries
|
||||||
recipe_name,
|
.iter()
|
||||||
*recipe,
|
.filter(|(_, (_, output_name))| {
|
||||||
self.show.crafting_fields.craft_sprite.map(|(_, s)| s)
|
match search_filter {
|
||||||
== recipe.craft_sprite,
|
SearchFilter::None => {
|
||||||
true,
|
let output_name = output_name.to_lowercase();
|
||||||
)
|
search_keys
|
||||||
}))
|
.iter()
|
||||||
|
.all(|&substring| output_name.contains(substring))
|
||||||
|
},
|
||||||
|
// TODO: Get input filtering to work here, probably requires
|
||||||
|
// checking component recipe book?
|
||||||
|
SearchFilter::Input => false,
|
||||||
|
SearchFilter::Nonexistant => false,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(|(recipe_name, (recipe, _))| {
|
||||||
|
(
|
||||||
|
recipe_name,
|
||||||
|
*recipe,
|
||||||
|
self.show.crafting_fields.craft_sprite.map(|(_, s)| s)
|
||||||
|
== recipe.craft_sprite,
|
||||||
|
true,
|
||||||
|
)
|
||||||
|
}),
|
||||||
|
)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flatten(),
|
.flatten(),
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user