aboutsummaryrefslogtreecommitdiff
path: root/server/src/interaction.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-09-16 18:00:28 +0200
committermetamuffin <metamuffin@disroot.org>2024-09-16 18:00:35 +0200
commit499f4994a6a8507dcca20ed820c851be9a2343c1 (patch)
tree9100c6c924e116e811d94d7188353f87819d02d3 /server/src/interaction.rs
parent709fd5ddaaec290165e85b48b237cb82563b9e87 (diff)
downloadhurrycurry-499f4994a6a8507dcca20ed820c851be9a2343c1.tar
hurrycurry-499f4994a6a8507dcca20ed820c851be9a2343c1.tar.bz2
hurrycurry-499f4994a6a8507dcca20ed820c851be9a2343c1.tar.zst
fix all clippy things
Diffstat (limited to 'server/src/interaction.rs')
-rw-r--r--server/src/interaction.rs105
1 files changed, 51 insertions, 54 deletions
diff --git a/server/src/interaction.rs b/server/src/interaction.rs
index 0721fa81..3a950fba 100644
--- a/server/src/interaction.rs
+++ b/server/src/interaction.rs
@@ -22,6 +22,7 @@ use std::collections::VecDeque;
use crate::data::index::GamedataIndex;
+#[allow(clippy::too_many_arguments)]
pub fn interact(
data: &Gamedata,
edge: bool,
@@ -108,32 +109,30 @@ pub fn interact(
}
if this.is_none() {
if let Some(item) = &other {
- if item.kind == *input {
- if item.active.is_none() {
- let mut item = other.take().unwrap();
- info!("start active recipe {ri:?}");
- item.active = Some(Involvement {
- player,
- recipe: ri,
- speed: *speed,
- 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;
- }
+ if item.kind == *input && item.active.is_none() {
+ let mut item = other.take().unwrap();
+ info!("start active recipe {ri:?}");
+ item.active = Some(Involvement {
+ player,
+ recipe: ri,
+ speed: *speed,
+ 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;
}
}
}
@@ -194,7 +193,6 @@ pub fn interact(
from: this_loc,
to: other_loc,
});
- return;
}
}
}
@@ -209,6 +207,7 @@ pub enum TickEffect {
Produce,
}
+#[allow(clippy::too_many_arguments)]
pub fn tick_slot(
dt: f32,
data: &Gamedata,
@@ -273,34 +272,31 @@ pub fn tick_slot(
warn: a.warn,
item: slot_loc,
});
- return;
}
- } else {
- if let Some(recipes) = data_index.recipe_passive_by_input.get(&item.kind) {
- for &ri in recipes {
- let recipe = data.recipe(ri);
- if recipe.supports_tile(tile) {
- if let Recipe::Passive {
- input, warn, speed, ..
- } = recipe
- {
- if *input == item.kind {
- item.active = Some(Involvement {
- player: None,
- recipe: ri,
- position: 0.,
- warn: *warn,
- speed: *speed,
- });
- packet_out.push_back(PacketC::SetProgress {
- player: None,
- position: 0.,
- speed: *speed,
- warn: *warn,
- item: slot_loc,
- });
- return;
- }
+ } else if let Some(recipes) = data_index.recipe_passive_by_input.get(&item.kind) {
+ for &ri in recipes {
+ let recipe = data.recipe(ri);
+ if recipe.supports_tile(tile) {
+ if let Recipe::Passive {
+ input, warn, speed, ..
+ } = recipe
+ {
+ if *input == item.kind {
+ item.active = Some(Involvement {
+ player: None,
+ recipe: ri,
+ position: 0.,
+ warn: *warn,
+ speed: *speed,
+ });
+ packet_out.push_back(PacketC::SetProgress {
+ player: None,
+ position: 0.,
+ speed: *speed,
+ warn: *warn,
+ item: slot_loc,
+ });
+ return;
}
}
}
@@ -309,6 +305,7 @@ pub fn tick_slot(
}
}
+#[allow(clippy::too_many_arguments)]
fn produce(
player: Option<PlayerID>,
this_had_item: bool,