refactor!: Split everything into submodules

- Bump version to 0.2.0
- Split every module to systems, observers, plugins, etc
- Renamed Crate to Container
- Removed Wall component
- Removed try_insert_item system
- Removed inventory::ui module
This commit is contained in:
Alexey 2026-03-19 14:23:26 +03:00
commit 7c386d4128
20 changed files with 830 additions and 772 deletions

41
src/input/mod.rs Normal file
View file

@ -0,0 +1,41 @@
use bevy::prelude::*;
use leafwing_input_manager::prelude::*;
use serde::{
Serialize,
Deserialize
};
pub mod plugin;
#[derive(Actionlike, PartialEq, Eq, Hash, Debug, Clone, Reflect, Serialize, Deserialize)]
pub enum InputAction {
#[actionlike(Axis)]
Move,
ToggleInventory,
Interact,
}
impl InputAction {
pub fn default_input_map() -> InputMap<Self> {
InputMap::default()
.with_axis(Self::Move, VirtualAxis::ad())
.with_axis(Self::Move, GamepadAxis::LeftStickX)
.with(Self::ToggleInventory, KeyCode::KeyI)
.with(Self::ToggleInventory, GamepadButton::Select)
.with(Self::Interact, KeyCode::KeyE)
.with(Self::Interact, GamepadButton::East)
}
}
#[derive(Actionlike, PartialEq, Eq, Hash, Debug, Clone, Reflect, Serialize, Deserialize)]
pub enum UiAction {
Rotate,
}
impl UiAction {
pub fn default_input_map() -> InputMap<Self> {
InputMap::default()
.with(Self::Rotate, KeyCode::KeyR)
.with(Self::Rotate, GamepadButton::West)
}
}