From 58f4ab0b26948bec13ba853c90298271e472169f Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 29 Jun 2024 16:10:07 +0200 Subject: implement points --- server/src/interaction.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server/src/interaction.rs') 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, inputs: [Option; 2], outputs: [Option; 2], + points: i64, }, } @@ -120,6 +121,7 @@ pub fn interact( tile_kind: TileIndex, this: &mut Option, other: &mut Option, + points: &mut i64, ) -> Option { 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); } } -- cgit v1.2.3-70-g09d2