summaryrefslogtreecommitdiff
path: root/dungeon/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dungeon/src/lib.rs')
-rw-r--r--dungeon/src/lib.rs24
1 files changed, 4 insertions, 20 deletions
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