aboutsummaryrefslogtreecommitdiff
path: root/server/src/game.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/game.rs')
-rw-r--r--server/src/game.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/src/game.rs b/server/src/game.rs
index 89ea7dfc..1692de34 100644
--- a/server/src/game.rs
+++ b/server/src/game.rs
@@ -136,7 +136,10 @@ impl Game {
self.lobby = gamedata.map_name == "lobby";
self.data = gamedata.into();
- self.score = Score::default();
+ self.score = Score {
+ time_remaining: timer.map(|dur| dur.as_secs_f64()).unwrap_or(0.),
+ ..Default::default()
+ };
self.end = timer.map(|dur| Instant::now() + dur);
self.entities = Arc::new(RwLock::new(self.data.entities.clone()));
@@ -415,6 +418,7 @@ impl Game {
None,
packet_out,
&mut self.score,
+ &mut self.score_changed,
false,
)
} else {
@@ -433,6 +437,7 @@ impl Game {
Some(tile.kind),
packet_out,
&mut self.score,
+ &mut self.score_changed,
false,
)
}
@@ -628,6 +633,7 @@ pub fn interact_effect(
this_tile_kind: Option<TileIndex>,
packet_out: &mut VecDeque<PacketC>,
score: &mut Score,
+ score_changed: &mut bool,
automated: bool,
) {
let this_had_item = this.is_some();
@@ -651,6 +657,7 @@ pub fn interact_effect(
}
InteractEffect::Produce => {
info!("produce {this_loc} <~ {other_loc}");
+ *score_changed = true;
if this_had_item {
packet_out.push_back(PacketC::SetProgress {
item: this_loc,