diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-13 18:36:04 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-13 18:36:04 +0200 |
commit | 6be3e8d2a0d1b89ac89fe2609460c4ffa03e3798 (patch) | |
tree | 3a07b8a367ac1b9f19d7c27a8f1a1b9fce267b32 /server/src | |
parent | cf5028bfa9e4502805563ad2c04f0b6c6e3b3f8e (diff) | |
download | hurrycurry-6be3e8d2a0d1b89ac89fe2609460c4ffa03e3798.tar hurrycurry-6be3e8d2a0d1b89ac89fe2609460c4ffa03e3798.tar.bz2 hurrycurry-6be3e8d2a0d1b89ac89fe2609460c4ffa03e3798.tar.zst |
fix active interaction while passive
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/interaction.rs | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/server/src/interaction.rs b/server/src/interaction.rs index db4e92a7..a8f80bd8 100644 --- a/server/src/interaction.rs +++ b/server/src/interaction.rs @@ -17,7 +17,7 @@ */ use hurrycurry_client_lib::{Involvement, Item}; use hurrycurry_protocol::{Gamedata, ItemLocation, PacketC, PlayerID, Recipe, Score, TileIndex}; -use log::{info, warn}; +use log::info; use std::collections::VecDeque; pub fn interact( @@ -107,10 +107,8 @@ pub fn interact( if this.is_none() { if let Some(item) = &other { if item.kind == *input { - let mut item = other.take().unwrap(); - if item.active.is_some() { - warn!("interact recipe tested when already active") - } else { + if item.active.is_none() { + let mut item = other.take().unwrap(); info!("start active recipe {ri:?}"); item.active = Some(Involvement { player, @@ -119,21 +117,21 @@ pub fn interact( position: 0., warn: false, }); + *this = Some(item); + score.active_recipes += 1; + packet_out.push_back(PacketC::MoveItem { + from: other_loc, + to: this_loc, + }); + packet_out.push_back(PacketC::SetProgress { + player, + item: this_loc, + position: 0., + speed: *speed, + warn: false, + }); + return; } - *this = Some(item); - score.active_recipes += 1; - packet_out.push_back(PacketC::MoveItem { - from: other_loc, - to: this_loc, - }); - packet_out.push_back(PacketC::SetProgress { - player, - item: this_loc, - position: 0., - speed: *speed, - warn: false, - }); - return; } } } |