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.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/server/src/interaction.rs b/server/src/interaction.rs
index 615d2aab..e3dccfba 100644
--- a/server/src/interaction.rs
+++ b/server/src/interaction.rs
@@ -192,12 +192,13 @@ pub fn interact(
} => {
let on_tile = this.as_ref().map(|i| i.kind);
let in_hand = other.as_ref().map(|i| i.kind);
- let ok = (inputs[0] == on_tile && inputs[1] == in_hand)
- || (inputs[1] == on_tile && inputs[0] == in_hand);
- if ok {
- info!("instant recipe {ri:?}");
- *other = outputs[0].map(|kind| Item { kind, active: None });
- *this = outputs[1].map(|kind| Item { kind, active: None });
+ let ok = inputs[0] == on_tile && inputs[1] == in_hand;
+ let ok_rev = inputs[1] == on_tile && inputs[0] == in_hand;
+ if ok || ok_rev {
+ info!("instant recipe {ri:?} reversed={ok_rev}");
+ 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 });
return Some(InteractEffect::Produce);
}
}