summaryrefslogtreecommitdiff
path: root/dungeon/src/entity.rs
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-11-18 10:24:03 -0500
committerFreya Murphy <freya@freyacat.org>2025-11-18 10:24:03 -0500
commitff315c10418ced36de7996bd9a521f8b96c90631 (patch)
tree75a50d8c46cae6096e9b6693d62c3d21f82587ad /dungeon/src/entity.rs
parentdungeon: split rng into game/level to make maps consistant (diff)
downloadDungeonCrawl-ff315c10418ced36de7996bd9a521f8b96c90631.tar.gz
DungeonCrawl-ff315c10418ced36de7996bd9a521f8b96c90631.tar.bz2
DungeonCrawl-ff315c10418ced36de7996bd9a521f8b96c90631.zip
dungeon: port rands SmallRng to be reproducible
Diffstat (limited to 'dungeon/src/entity.rs')
-rw-r--r--dungeon/src/entity.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/dungeon/src/entity.rs b/dungeon/src/entity.rs
index b290a2f..3a8f131 100644
--- a/dungeon/src/entity.rs
+++ b/dungeon/src/entity.rs
@@ -2,13 +2,14 @@
use std::mem::take;
-use rand::{Rng, rngs::SmallRng};
+use rand::Rng;
use crate::{
Dungeon, astar, const_pos,
map::Floor,
player_input::PlayerInput,
pos::{Direction, FPos, Pos},
+ rng::DungeonRng,
};
/// `PLAYER_FULL_HEALTH` is the starting health of the player entity
@@ -97,7 +98,7 @@ impl EnemyMoveState {
///
/// Will randomly pick a direction and number of tiles within roaming range to move.
/// If an invalid tile is selected 50 times in a row, `EnemyMoveState::Idle` is returned instead.
- pub fn roam(starting_pos: Pos, floor: &Floor, rng: &mut SmallRng) -> Self {
+ pub fn roam(starting_pos: Pos, floor: &Floor, rng: &mut DungeonRng) -> Self {
let mut loop_index = 0;
loop {
let dir = rng.random();
@@ -274,7 +275,7 @@ impl Default for Player {
struct Updater<'a> {
floor: &'a Floor,
- rng: &'a mut SmallRng,
+ rng: &'a mut DungeonRng,
player_pos: Pos,
input: PlayerInput,
delta_time: f32,