aboutsummaryrefslogtreecommitdiff
path: root/server/src/entity/customers.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-10-10 18:06:37 +0200
committermetamuffin <metamuffin@disroot.org>2025-10-10 18:06:37 +0200
commit3fe8ba7f1b9fa7e38fa03f55fd898c8ca2a0e996 (patch)
treec3913fce710a879e2375c60a2b78e0cad483de18 /server/src/entity/customers.rs
parentf78856e4cd4928c790748b883b7916585980b3dd (diff)
downloadhurrycurry-3fe8ba7f1b9fa7e38fa03f55fd898c8ca2a0e996.tar
hurrycurry-3fe8ba7f1b9fa7e38fa03f55fd898c8ca2a0e996.tar.bz2
hurrycurry-3fe8ba7f1b9fa7e38fa03f55fd898c8ca2a0e996.tar.zst
Update to newest rust; replace rand with std random
Diffstat (limited to 'server/src/entity/customers.rs')
-rw-r--r--server/src/entity/customers.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/server/src/entity/customers.rs b/server/src/entity/customers.rs
index 22522e4e..1e795ac5 100644
--- a/server/src/entity/customers.rs
+++ b/server/src/entity/customers.rs
@@ -1,3 +1,7 @@
+use std::random::random;
+
+use crate::random_float;
+
/*
Hurry Curry! - a game about cooking
Copyright (C) 2025 Hurry Curry! Contributors
@@ -15,11 +19,10 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-use super::{bot::BotDriver, Entity, EntityContext};
+use super::{Entity, EntityContext, bot::BotDriver};
use anyhow::Result;
use hurrycurry_bot::algos::{Customer, CustomerConfig};
use hurrycurry_protocol::{Character, PlayerClass};
-use rand::random;
pub struct Customers {
customers: Vec<BotDriver<Customer>>,
@@ -53,12 +56,12 @@ impl Entity for Customers {
self.spawn_cooldown -= c.dt;
self.spawn_cooldown = self.spawn_cooldown.max(0.);
if self.customers.len() < max_count && self.spawn_cooldown <= 0. {
- self.spawn_cooldown = 5. + random::<f32>() * 5.;
+ self.spawn_cooldown = 5. + random_float() * 5.;
let bot = BotDriver::new(
"".to_string(),
Character {
- color: random(),
- hairstyle: random(),
+ color: random(..),
+ hairstyle: random(..),
headwear: 0,
},
PlayerClass::Customer,