From a859bceeddc8e746bba630b3cc197532b68adbcb Mon Sep 17 00:00:00 2001 From: nokoe Date: Thu, 26 Feb 2026 05:15:54 +0100 Subject: use stable rust toolchain --- server/src/entity/customers.rs | 9 ++++----- server/src/entity/pedestrians.rs | 7 ++++--- server/src/entity/tag_minigame.rs | 5 +++-- 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'server/src/entity') diff --git a/server/src/entity/customers.rs b/server/src/entity/customers.rs index c1bfb525..f6a50fa8 100644 --- a/server/src/entity/customers.rs +++ b/server/src/entity/customers.rs @@ -16,12 +16,11 @@ */ use super::{Entity, EntityContext, bot::BotDriver}; -use crate::random_float; use anyhow::Result; use hurrycurry_bot::algos::Customer; use hurrycurry_locale::TrError; use hurrycurry_protocol::{Character, PlayerClass}; -use std::random::random; +use rand::random; pub struct Customers { customers: Vec>, @@ -58,12 +57,12 @@ impl Entity for Customers { self.current_spawn_cooldown = self.current_spawn_cooldown.max(0.); if self.customers.len() < max_count && self.current_spawn_cooldown <= 0. { self.current_spawn_cooldown = - self.spawn_cooldown + random_float() * self.spawn_cooldown; + self.spawn_cooldown + random::() * self.spawn_cooldown; let bot = BotDriver::new( "".to_string(), Character { - color: random(..), - hairstyle: random(..), + color: random(), + hairstyle: random(), headwear: 0, }, PlayerClass::Customer, diff --git a/server/src/entity/pedestrians.rs b/server/src/entity/pedestrians.rs index 0d33bfd0..4fe91464 100644 --- a/server/src/entity/pedestrians.rs +++ b/server/src/entity/pedestrians.rs @@ -21,7 +21,8 @@ use super::{Entity, EntityContext}; use anyhow::Result; use hurrycurry_locale::TrError; use hurrycurry_protocol::{Character, PacketS, PlayerClass, PlayerID, glam::Vec2}; -use std::{collections::HashMap, random::random}; +use rand::random; +use std::collections::HashMap; pub struct Pedestrians { pub players: HashMap, @@ -44,8 +45,8 @@ impl Entity for Pedestrians { id: Some(id), name: "Pedestrian".to_string(), character: Character { - color: random(..), - hairstyle: random(..), + color: random(), + hairstyle: random(), headwear: 0, }, class: PlayerClass::Customer, diff --git a/server/src/entity/tag_minigame.rs b/server/src/entity/tag_minigame.rs index e45422b7..f1975f22 100644 --- a/server/src/entity/tag_minigame.rs +++ b/server/src/entity/tag_minigame.rs @@ -22,7 +22,8 @@ use hurrycurry_locale::TrError; use hurrycurry_protocol::{ Hand, ItemIndex, ItemLocation, Message, PacketC, PlayerID, TileIndex, glam::IVec2, }; -use std::{collections::HashMap, fmt::Write, random::random}; +use rand::RngExt; +use std::{collections::HashMap, fmt::Write}; #[derive(Debug, Clone)] pub struct TagMinigame { @@ -60,7 +61,7 @@ impl Entity for TagMinigame { if player_ids.is_empty() { break; } - let id = player_ids[random::(..) % player_ids.len()]; + let id = player_ids[usize::from_ne_bytes(rand::rng().random())]; let player = c.game.players.get_mut(&id).expect("just got the ids"); if let Some(slot) = player.items.get_mut(0) { *slot = Some(Item { -- cgit v1.3