From 2d4644889dafa69c06e284b8b2cd18d2f65e57bc Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Thu, 20 Nov 2025 18:23:20 -0500 Subject: dungeon: refactor player out of entity.rs --- dungeon/src/lib.rs | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'dungeon/src/lib.rs') diff --git a/dungeon/src/lib.rs b/dungeon/src/lib.rs index fa75c10..91ab378 100644 --- a/dungeon/src/lib.rs +++ b/dungeon/src/lib.rs @@ -6,6 +6,7 @@ pub mod bsp; pub mod entity; pub mod map; pub mod msg; +pub mod player; pub mod player_input; pub mod pos; pub mod rng; @@ -13,32 +14,15 @@ pub mod rng; use rand::{Rng, SeedableRng, TryRngCore, rngs::OsRng}; use crate::{ - entity::{Entity, Player}, + entity::Entity, map::{Floor, Tile}, msg::Message, + player::{Player, PlayerAction}, player_input::PlayerInput, pos::FPos, rng::DungeonRng, }; -/// Lets the caller know what actions -/// exactly the player has done -#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub struct PlayerAction { - // The player picked up an item - pub pickup_item: bool, - // The player dropped an item - pub drop_item: bool, - // The player moved - pub walk: bool, - // The player attacked - pub attack: bool, - // The player used a bomb - pub bomb: bool, - // The player used a potion - pub potion: bool, -} - /// Lets the caller know what has /// changed in the game state this /// tick @@ -145,7 +129,7 @@ impl Dungeon { let changed = self.msg.update(player_input); UpdateResult::MessageUpdated(changed) } else { - let mut action = self.update_player(player_input, delta_time); + let mut action = self.update_player(player_input); let curr_player_pos = self.player.entity.fpos; self.update_entities(player_input, delta_time); if self -- cgit v1.2.3-freya