aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/menu/scene_transition.gd4
-rw-r--r--server/src/customer/mod.rs9
-rw-r--r--server/src/game.rs2
-rw-r--r--server/src/state.rs14
4 files changed, 23 insertions, 6 deletions
diff --git a/client/menu/scene_transition.gd b/client/menu/scene_transition.gd
index 8fe078e6..85ba5e55 100644
--- a/client/menu/scene_transition.gd
+++ b/client/menu/scene_transition.gd
@@ -27,7 +27,7 @@ func _ready():
$ColorRect.visible = true
func fade_in():
- if fading: push_error("transition busy (in)"); return
+ if fading: await anim.animation_finished
if not black: push_error("already faded in"); return
fading = true
anim.play_backwards("fade")
@@ -36,7 +36,7 @@ func fade_in():
fading = false; black = false
func fade_out():
- if fading: push_error("transition busy (out)"); return
+ if fading: await anim.animation_finished
if black: push_error("already faded out"); return
fading = true
self.mouse_filter = Control.MOUSE_FILTER_STOP
diff --git a/server/src/customer/mod.rs b/server/src/customer/mod.rs
index f90b2eb2..8e6f1db6 100644
--- a/server/src/customer/mod.rs
+++ b/server/src/customer/mod.rs
@@ -41,6 +41,7 @@ pub struct DemandState {
chairs: HashMap<IVec2, bool>,
customer_id_counter: PlayerID,
customers: HashMap<PlayerID, Customer>,
+ spawn_cooldown: f32,
pub completed: usize,
pub failed: usize,
@@ -93,6 +94,7 @@ impl DemandState {
customer_id_counter: PlayerID(0),
customers: Default::default(),
data,
+ spawn_cooldown: 0.,
}
}
}
@@ -106,7 +108,10 @@ impl DemandState {
dt: f32,
points: &mut i64,
) -> Result<()> {
- if self.customers.len() < 5 {
+ self.spawn_cooldown -= dt;
+ self.spawn_cooldown = self.spawn_cooldown.max(0.);
+ if self.customers.len() < 5 && self.spawn_cooldown <= 0. {
+ self.spawn_cooldown = 5. + random::<f32>() * 10.;
self.customer_id_counter.0 -= 1;
let id = self.customer_id_counter;
packets_out.push((
@@ -145,7 +150,7 @@ impl DemandState {
));
p.state = CustomerState::Waiting {
chair: *chair,
- timeout: 60.,
+ timeout: 60. + random::<f32>() * 30.,
demand,
};
}
diff --git a/server/src/game.rs b/server/src/game.rs
index 599aadbd..54266351 100644
--- a/server/src/game.rs
+++ b/server/src/game.rs
@@ -62,7 +62,7 @@ pub struct Player {
pub struct Game {
data: Arc<Gamedata>,
tiles: HashMap<IVec2, Tile>,
- players: HashMap<PlayerID, Player>,
+ pub players: HashMap<PlayerID, Player>,
packet_out: VecDeque<PacketC>,
demand: Option<DemandState>,
pub points: i64,
diff --git a/server/src/state.rs b/server/src/state.rs
index ffcc8fa2..4716d271 100644
--- a/server/src/state.rs
+++ b/server/src/state.rs
@@ -22,7 +22,7 @@ enum Command {
Start {
#[arg(default_value = "small-default-default")]
spec: String,
- #[arg(default_value = "300")]
+ #[arg(default_value = "420")]
timer: u64,
},
Effect {
@@ -99,6 +99,18 @@ impl State {
self.game.load(data, Some(Duration::from_secs(timer)));
}
Command::End => {
+ self.tx
+ .send(PacketC::ServerMessage {
+ text: format!(
+ "Game was aborted by {}.",
+ self.game
+ .players
+ .get(&player)
+ .ok_or(anyhow!("player missing"))?
+ .name
+ ),
+ })
+ .ok();
self.game
.load(self.index.generate("lobby-none-none".to_string())?, None);
}