refactor: Refactor interaction option logic
This commit is contained in:
@@ -32,31 +32,29 @@ impl InteractionAction {
|
||||
) -> Vec<InteractionAction> {
|
||||
let mut options: Vec<InteractionAction> = 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()));
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user