feat: Add has_item helper to Inventory

This commit is contained in:
demenik
2025-12-02 12:54:09 +01:00
parent 3da9931513
commit c5c4b31d71

View File

@@ -114,6 +114,14 @@ pub struct Inventory {
}
impl Inventory {
pub fn has_item(&self, items_query: Query<&ItemStack>) -> bool {
self.items
.iter()
.map(|entity| items_query.get(*entity).ok())
.find(|option| option.is_some())
.is_some()
}
pub fn update_item_stack(
&mut self,
commands: &mut Commands,