diff options
author | metamuffin <metamuffin@disroot.org> | 2025-06-03 19:45:05 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-06-03 19:45:08 +0200 |
commit | 9ee7eef2919feffe4e0695494d4027e8ec011808 (patch) | |
tree | 4fbb5347e7166911d08ae31dd3c20556b61c943e /server/src/entity/mod.rs | |
parent | 63f7321e50b251d19f20dc929fc37a45cccdbb38 (diff) | |
download | hurrycurry-9ee7eef2919feffe4e0695494d4027e8ec011808.tar hurrycurry-9ee7eef2919feffe4e0695494d4027e8ec011808.tar.bz2 hurrycurry-9ee7eef2919feffe4e0695494d4027e8ec011808.tar.zst |
Add pedestrians (and custom spawn locations)
Diffstat (limited to 'server/src/entity/mod.rs')
-rw-r--r-- | server/src/entity/mod.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/server/src/entity/mod.rs b/server/src/entity/mod.rs index ddafc2f7..75ea0e9b 100644 --- a/server/src/entity/mod.rs +++ b/server/src/entity/mod.rs @@ -22,12 +22,14 @@ pub mod conveyor; pub mod customers; pub mod environment_effect; pub mod item_portal; +pub mod pedestrians; pub mod player_portal; pub mod tram; pub mod tutorial; use crate::{ data::{ItemTileRegistry, Serverdata}, + entity::pedestrians::Pedestrians, message::TrError, scoreboard::ScoreboardStore, }; @@ -45,7 +47,10 @@ use hurrycurry_protocol::{ use item_portal::ItemPortal; use player_portal::PlayerPortal; use serde::{Deserialize, Serialize}; -use std::{any::Any, collections::VecDeque}; +use std::{ + any::Any, + collections::{HashMap, VecDeque}, +}; use tram::Tram; pub type DynEntity = Box<dyn Entity + Send + Sync + 'static>; @@ -143,6 +148,11 @@ pub enum EntityDecl { smoothing: f32, }, Book, + Pedestrians { + spawn_delay: f32, + spawn_delay_stdev: f32, + points: Vec<Vec2>, + }, } pub fn construct_entity( @@ -222,5 +232,15 @@ pub fn construct_entity( spacing, smoothing, }), + EntityDecl::Pedestrians { + spawn_delay, + spawn_delay_stdev, + points, + } => Box::new(Pedestrians { + players: HashMap::new(), + points, + spawn_delay_distr: rand_distr::Normal::new(spawn_delay, spawn_delay_stdev).unwrap(), + cooldown: 0., + }), }) } |