From c0b7131a5db1d6965b25a9b689ccf0d1a2f70f53 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 1 Oct 2024 17:52:41 +0200 Subject: customer scaling factor --- server/src/entity/customers.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server/src/entity/customers.rs') diff --git a/server/src/entity/customers.rs b/server/src/entity/customers.rs index a9ddb6f1..1e8b6b13 100644 --- a/server/src/entity/customers.rs +++ b/server/src/entity/customers.rs @@ -25,14 +25,16 @@ pub struct Customers { customers: Vec>, spawn_cooldown: f32, chair_count: Option, + scaling_factor: f32, } impl Customers { - pub fn new() -> Result { + pub fn new(scaling_factor: f32) -> Result { Ok(Self { customers: Default::default(), spawn_cooldown: 0., chair_count: None, + scaling_factor, }) } } @@ -46,7 +48,7 @@ impl Entity for Customers { .filter(|t| c.game.data.tile_name(t.kind) == "chair") .count() }); - let max_count = 5.min(chairs); + let max_count = (self.scaling_factor * chairs as f32).max(1.) as usize; self.spawn_cooldown -= c.dt; self.spawn_cooldown = self.spawn_cooldown.max(0.); -- cgit v1.2.3-70-g09d2