summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-10-01 17:52:41 +0200
committermetamuffin <metamuffin@disroot.org>2024-10-01 17:58:24 +0200
commitc0b7131a5db1d6965b25a9b689ccf0d1a2f70f53 (patch)
tree2d037a8de86084b171e0598874b8f3eb54c8ea6c
parent99857c6f73c2dfcbc8f84ccfafa2481d2f006d3e (diff)
downloadhurrycurry-c0b7131a5db1d6965b25a9b689ccf0d1a2f70f53.tar
hurrycurry-c0b7131a5db1d6965b25a9b689ccf0d1a2f70f53.tar.bz2
hurrycurry-c0b7131a5db1d6965b25a9b689ccf0d1a2f70f53.tar.zst
customer scaling factor
-rw-r--r--data/maps/5star.yaml5
-rw-r--r--data/maps/anticurry.yaml1
-rw-r--r--data/maps/bbq.yaml1
-rw-r--r--data/maps/duplex.yaml1
-rw-r--r--data/maps/junior.yaml2
-rw-r--r--data/maps/line.yaml1
-rw-r--r--data/maps/senior.yaml2
-rw-r--r--data/maps/station.yaml1
-rw-r--r--data/maps/sushibar.yaml2
-rw-r--r--data/maps/teeny.yaml1
-rw-r--r--data/maps/village.yaml1
-rw-r--r--data/maps/zigzag.yaml1
-rw-r--r--server/src/entity/customers.rs6
-rw-r--r--server/src/entity/mod.rs8
-rw-r--r--server/src/server.rs5
15 files changed, 28 insertions, 10 deletions
diff --git a/data/maps/5star.yaml b/data/maps/5star.yaml
index 10fdeeb3..c635e3c5 100644
--- a/data/maps/5star.yaml
+++ b/data/maps/5star.yaml
@@ -33,8 +33,8 @@ map:
- " ''█...........W..#█L..D█'-'' "
- " ''█...........W..P█A..E█'-'' "
- " ''█.c......c..W..P██dd██'-'' "
- - " ''▒ctc....ctc.W.......C█'-'' "
- - "'''▒ctc....ctc.█.......#█'-'' "
+ - " ''▒ctc....ctc.█.......C█'-'' "
+ - "'''▒ctc....ctc.d.......#█'-'' "
- "'''█.c......c..█ffoo####█'-'' "
- "'''██▒███dd██▒██████▒██▒█'-'' "
- "'''''''''--'''''''''''''''-'''"
@@ -97,6 +97,7 @@ items:
entities:
- !customers
+ scaling_factor: 0.25
chef_spawn: ","
customer_spawn: "!"
diff --git a/data/maps/anticurry.yaml b/data/maps/anticurry.yaml
index 93a0d97c..f0c386ab 100644
--- a/data/maps/anticurry.yaml
+++ b/data/maps/anticurry.yaml
@@ -70,6 +70,7 @@ customer_spawn: "!"
entities:
- !customers
+ scaling_factor: 0.7
walkable:
- door
diff --git a/data/maps/bbq.yaml b/data/maps/bbq.yaml
index 00d8f009..257f49bc 100644
--- a/data/maps/bbq.yaml
+++ b/data/maps/bbq.yaml
@@ -67,6 +67,7 @@ items:
entities:
- !customers
+ scaling_factor: 0.3
chef_spawn: "~"
customer_spawn: "~"
diff --git a/data/maps/duplex.yaml b/data/maps/duplex.yaml
index 1265c327..a77adc65 100644
--- a/data/maps/duplex.yaml
+++ b/data/maps/duplex.yaml
@@ -82,6 +82,7 @@ items:
entities:
- !customers
+ scaling_factor: 0.25
chef_spawn: "~"
customer_spawn: "~"
diff --git a/data/maps/junior.yaml b/data/maps/junior.yaml
index 14b4dee3..77437a7c 100644
--- a/data/maps/junior.yaml
+++ b/data/maps/junior.yaml
@@ -71,6 +71,8 @@ customer_spawn: "!"
entities:
- !customers
+ scaling_factor: 0.25
+
tile_entities:
"b": !book
diff --git a/data/maps/line.yaml b/data/maps/line.yaml
index 5823cc88..4c660ed6 100644
--- a/data/maps/line.yaml
+++ b/data/maps/line.yaml
@@ -62,6 +62,7 @@ customer_spawn: "!"
entities:
- !customers
+ scaling_factor: 0.5
walkable:
- door
diff --git a/data/maps/senior.yaml b/data/maps/senior.yaml
index eb81c33c..a2f99499 100644
--- a/data/maps/senior.yaml
+++ b/data/maps/senior.yaml
@@ -72,6 +72,8 @@ items:
entities:
- !customers
+ scaling_factor: 0.3
+
tile_entities:
"b": !book
diff --git a/data/maps/station.yaml b/data/maps/station.yaml
index 44a34697..e872a12f 100644
--- a/data/maps/station.yaml
+++ b/data/maps/station.yaml
@@ -69,6 +69,7 @@ items:
entities:
- !customers
+ scaling_factor: 0.7
chef_spawn: "~"
customer_spawn: "!"
diff --git a/data/maps/sushibar.yaml b/data/maps/sushibar.yaml
index 1d316984..d5313855 100644
--- a/data/maps/sushibar.yaml
+++ b/data/maps/sushibar.yaml
@@ -74,6 +74,8 @@ items:
entities:
- !customers
+ scaling_factor: 0.5
+
tile_entities:
"b": !book
diff --git a/data/maps/teeny.yaml b/data/maps/teeny.yaml
index 02305f48..e0d84b55 100644
--- a/data/maps/teeny.yaml
+++ b/data/maps/teeny.yaml
@@ -66,6 +66,7 @@ items:
entities:
- !customers
+ scaling_factor: 0.3
chef_spawn: "~"
customer_spawn: "~"
diff --git a/data/maps/village.yaml b/data/maps/village.yaml
index 155420c0..9538ae9d 100644
--- a/data/maps/village.yaml
+++ b/data/maps/village.yaml
@@ -77,6 +77,7 @@ items:
entities:
- !customers
+ scaling_factor: 0.1
chef_spawn: "~"
customer_spawn: "!"
diff --git a/data/maps/zigzag.yaml b/data/maps/zigzag.yaml
index c1d3ed32..981d1cb8 100644
--- a/data/maps/zigzag.yaml
+++ b/data/maps/zigzag.yaml
@@ -82,6 +82,7 @@ items:
entities:
- !customers
+ scaling_factor: 0.35
chef_spawn: "~"
customer_spawn: "!"
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<BotDriver<Customer>>,
spawn_cooldown: f32,
chair_count: Option<usize>,
+ scaling_factor: f32,
}
impl Customers {
- pub fn new() -> Result<Self> {
+ pub fn new(scaling_factor: f32) -> Result<Self> {
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.);
diff --git a/server/src/entity/mod.rs b/server/src/entity/mod.rs
index 15e9b0d8..87656f0d 100644
--- a/server/src/entity/mod.rs
+++ b/server/src/entity/mod.rs
@@ -115,7 +115,9 @@ pub enum EntityDecl {
from: Option<Vec2>,
to: Vec2,
},
- Customers {},
+ Customers {
+ scaling_factor: Option<f32>,
+ },
Map {
name: String,
location: Option<Vec2>,
@@ -185,9 +187,9 @@ pub fn construct_entity(
blocker_tile: reg.register_tile("fence".to_string()),
active: true,
}),
- EntityDecl::Customers {} => {
+ EntityDecl::Customers { scaling_factor } => {
reg.register_item("unknown-order".to_owned());
- Box::new(Customers::new()?)
+ Box::new(Customers::new(scaling_factor.unwrap_or(0.5))?)
}
EntityDecl::EnvironmentEffect(config) => Box::new(EnvironmentEffectController::new(config)),
EntityDecl::Environment(names) => Box::new(EnvironmentController(names)),
diff --git a/server/src/server.rs b/server/src/server.rs
index 1d57a200..d8470fb8 100644
--- a/server/src/server.rs
+++ b/server/src/server.rs
@@ -413,7 +413,7 @@ impl Server {
PacketS::Movement {
pos,
boost,
- dir: direction,
+ dir,
player,
} => {
let pd = self
@@ -422,7 +422,7 @@ impl Server {
.get_mut(&player)
.ok_or(tre!("s.error.no_player"))?;
- pd.movement.input(direction, boost);
+ pd.movement.input(dir, boost);
if let Some(pos) = pos {
let last_position_update = self
@@ -433,7 +433,6 @@ impl Server {
*last_position_update += dt;
let diff = pos - pd.movement.position;
pd.movement.position += diff.clamp_length_max(dt.as_secs_f32());
-
if diff.length() > 1. {
replies.push(PacketC::MovementSync { player });
}