From afe3b978942df782f1d4dc3588a142a2506bb7c6 Mon Sep 17 00:00:00 2001 From: demenik Date: Thu, 27 Nov 2025 17:47:10 +0100 Subject: [PATCH] feat: Add inventory and item components (#48) --- src/features/inventory/components.rs | 9 +++++++++ src/features/inventory/mod.rs | 11 +++++++++++ src/features/mod.rs | 2 ++ src/main.rs | 1 + src/prelude.rs | 1 + 5 files changed, 24 insertions(+) create mode 100644 src/features/inventory/components.rs create mode 100644 src/features/inventory/mod.rs diff --git a/src/features/inventory/components.rs b/src/features/inventory/components.rs new file mode 100644 index 0000000..009269f --- /dev/null +++ b/src/features/inventory/components.rs @@ -0,0 +1,9 @@ +use crate::prelude::*; + +#[derive(Component)] +pub struct Item; + +#[derive(Resource, Default)] +pub struct Inventory { + pub items: Vec, +} diff --git a/src/features/inventory/mod.rs b/src/features/inventory/mod.rs new file mode 100644 index 0000000..128d7c5 --- /dev/null +++ b/src/features/inventory/mod.rs @@ -0,0 +1,11 @@ +use crate::prelude::*; + +pub mod components; + +pub struct InventoryPlugin; + +impl Plugin for InventoryPlugin { + fn build(&self, app: &mut App) { + app.init_resource::(); + } +} diff --git a/src/features/mod.rs b/src/features/mod.rs index 3cd19db..d426610 100644 --- a/src/features/mod.rs +++ b/src/features/mod.rs @@ -3,6 +3,7 @@ pub mod core; pub mod game_screen; pub mod grid; pub mod input; +pub mod inventory; pub mod phase; pub mod pom; pub mod savegame; @@ -14,6 +15,7 @@ pub use core::CorePlugin; pub use game_screen::GameScreenPlugin; pub use grid::GridPlugin; pub use input::InputPlugin; +pub use inventory::InventoryPlugin; pub use phase::PhasePlugin; pub use pom::PomPlugin; pub use savegame::SavegamePlugin; diff --git a/src/main.rs b/src/main.rs index 8b26ce0..5c07bfc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,6 +32,7 @@ fn main() { features::StatusPlugin, features::SavegamePlugin, features::UiPlugin, + features::InventoryPlugin, )) .insert_resource(config) .run(); diff --git a/src/prelude.rs b/src/prelude.rs index 15a1fc2..5bfe8e3 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -7,6 +7,7 @@ pub use crate::features::{ consts::TILE_SIZE, utils::{grid_to_world_coords, world_to_grid_coords}, }, + inventory::components::{Inventory, Item}, phase::components::{CurrentPhase, Phase}, pom::{ components::{GridPosition, MovingState, Pom},