refactor: Refactor interaction option logic

This commit is contained in:
demenik
2025-12-02 16:22:12 +01:00
parent c60b2ce2b3
commit 76a0c4340c

View File

@@ -32,6 +32,13 @@ impl InteractionAction {
) -> Vec<InteractionAction> {
let mut options: Vec<InteractionAction> = vec![];
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;
@@ -40,22 +47,13 @@ impl InteractionAction {
continue;
}
match tile_state {
TileState::Empty => match &stack.item_type {
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);
}
}
_ => (),
}