feat: Add berry debug binds
This commit is contained in:
@@ -41,6 +41,8 @@ cargo run
|
||||
|
||||
- `Shift + Enter`: Duration of the current phase is set to 3 seconds.
|
||||
- `Left Mouse Button` on Tile: Rotate tile state.
|
||||
- `Shift + Arrow Up`: Add one berry to your inventory
|
||||
- `Shift + Arrow Down`: Remove one berry from your inventory
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ impl Plugin for InventoryPlugin {
|
||||
app.init_resource::<Inventory>();
|
||||
|
||||
app.add_systems(Update, buttons.run_if(in_state(AppState::GameScreen)));
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
app.add_systems(Update, debug_modify_berries);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,3 +43,21 @@ fn buttons(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
fn debug_modify_berries(
|
||||
mut commands: Commands,
|
||||
mut inventory: ResMut<Inventory>,
|
||||
mut items: Query<&mut ItemStack>,
|
||||
keys: Res<ButtonInput<KeyCode>>,
|
||||
) {
|
||||
if keys.any_pressed([KeyCode::ShiftLeft, KeyCode::ShiftRight]) {
|
||||
if keys.just_pressed(KeyCode::ArrowUp) {
|
||||
println!("Adding 1 berry using debug bind");
|
||||
inventory.update_item_stack(&mut commands, &mut items, ItemType::Berry, 1);
|
||||
} else if keys.just_pressed(KeyCode::ArrowDown) {
|
||||
println!("Removing 1 berry using debug bind");
|
||||
inventory.update_item_stack(&mut commands, &mut items, ItemType::Berry, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user