From 76a0c4340c74da2c82e2f23e1fa3165ad35cbda8 Mon Sep 17 00:00:00 2001 From: demenik Date: Tue, 2 Dec 2025 16:22:12 +0100 Subject: [PATCH] refactor: Refactor interaction option logic --- src/features/pom/actions.rs | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/features/pom/actions.rs b/src/features/pom/actions.rs index 6dd0b2b..32afa34 100644 --- a/src/features/pom/actions.rs +++ b/src/features/pom/actions.rs @@ -32,31 +32,29 @@ impl InteractionAction { ) -> Vec { let mut options: Vec = vec![]; - for &entity in &inventory.items { - let Ok(stack) = item_query.get(entity) else { - continue; - }; - if stack.amount <= 0 { - continue; - } - - match tile_state { - TileState::Empty => match &stack.item_type { - ItemType::BerrySeed { .. } => { - options.push(InteractionAction::Plant(stack.item_type.clone())); - } - _ => (), - }, - _ => (), - } - } - match tile_state { TileState::Occupied { watered, .. } => { if !*watered { options.push(InteractionAction::Water); } } + TileState::Empty => { + for &entity in &inventory.items { + let Ok(stack) = item_query.get(entity) else { + continue; + }; + if stack.amount <= 0 { + continue; + } + + match &stack.item_type { + ItemType::BerrySeed { .. } => { + options.push(InteractionAction::Plant(stack.item_type.clone())); + } + _ => (), + } + } + } _ => (), }