summaryrefslogtreecommitdiff
path: root/server/src/interaction.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/interaction.rs')
-rw-r--r--server/src/interaction.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/src/interaction.rs b/server/src/interaction.rs
index 2f6c940a..71125ac4 100644
--- a/server/src/interaction.rs
+++ b/server/src/interaction.rs
@@ -19,7 +19,7 @@ use crate::{
data::Gamedata,
game::{Involvement, Item},
};
-use hurrycurry_protocol::{ItemIndex, TileIndex};
+use hurrycurry_protocol::{ItemIndex, Score, TileIndex};
use log::info;
use serde::{Deserialize, Serialize};
@@ -115,7 +115,7 @@ pub fn interact(
tile: Option<TileIndex>,
this: &mut Option<Item>,
other: &mut Option<Item>,
- points: &mut i64,
+ score: &mut Score,
automated: bool,
) -> Option<InteractEffect> {
let interactable = automated
@@ -180,6 +180,7 @@ pub fn interact(
});
}
*this = Some(item);
+ score.active_recipes += 1;
return Some(InteractEffect::Put);
}
}
@@ -200,7 +201,8 @@ pub fn interact(
let ok_rev = ok_rev as usize;
*other = outputs[1 - ok_rev].map(|kind| Item { kind, active: None });
*this = outputs[ok_rev].map(|kind| Item { kind, active: None });
- *points += pd;
+ score.points += pd;
+ score.instant_recipes += 1;
return Some(InteractEffect::Produce);
}
}
@@ -234,6 +236,7 @@ pub fn tick_slot(
data: &Gamedata,
tile: Option<TileIndex>,
slot: &mut Option<Item>,
+ score: &mut Score,
) -> Option<TickEffect> {
if let Some(item) = slot {
if let Some(a) = &mut item.active {
@@ -246,6 +249,7 @@ pub fn tick_slot(
if a.progress >= 1. {
if let Recipe::Passive { output, .. } = &data.recipe(a.recipe) {
*slot = output.map(|kind| Item { kind, active: None });
+ score.passive_recipes += 1;
return Some(TickEffect::Produce);
};
a.progress = 1.;