aboutsummaryrefslogtreecommitdiff
path: root/server/src/interaction.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-06-29 16:10:07 +0200
committermetamuffin <metamuffin@disroot.org>2024-06-29 16:10:07 +0200
commit58f4ab0b26948bec13ba853c90298271e472169f (patch)
tree9fa6e4443addf067310ff9ba868ec72b9e237637 /server/src/interaction.rs
parentb0042dce860406431f2e486112b14987c665f6a8 (diff)
downloadhurrycurry-58f4ab0b26948bec13ba853c90298271e472169f.tar
hurrycurry-58f4ab0b26948bec13ba853c90298271e472169f.tar.bz2
hurrycurry-58f4ab0b26948bec13ba853c90298271e472169f.tar.zst
implement points
Diffstat (limited to 'server/src/interaction.rs')
-rw-r--r--server/src/interaction.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/server/src/interaction.rs b/server/src/interaction.rs
index e3dccfba..69fc9e70 100644
--- a/server/src/interaction.rs
+++ b/server/src/interaction.rs
@@ -43,6 +43,7 @@ pub enum Recipe {
tile: Option<TileIndex>,
inputs: [Option<ItemIndex>; 2],
outputs: [Option<ItemIndex>; 2],
+ points: i64,
},
}
@@ -120,6 +121,7 @@ pub fn interact(
tile_kind: TileIndex,
this: &mut Option<Item>,
other: &mut Option<Item>,
+ points: &mut i64,
) -> Option<InteractEffect> {
let interactable = data.is_tile_interactable(tile_kind);
if interactable && other.is_none() {
@@ -188,7 +190,10 @@ pub fn interact(
}
}
Recipe::Instant {
- inputs, outputs, ..
+ inputs,
+ outputs,
+ points: pd,
+ ..
} => {
let on_tile = this.as_ref().map(|i| i.kind);
let in_hand = other.as_ref().map(|i| i.kind);
@@ -199,6 +204,7 @@ 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;
return Some(InteractEffect::Produce);
}
}