From 0070a881c94767b7255adb74dcf638e2aef8028f Mon Sep 17 00:00:00 2001 From: ghostlyzsh Date: Wed, 10 Jan 2024 21:24:04 -0600 Subject: [PATCH] appease the git --- server/src/main.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/server/src/main.rs b/server/src/main.rs index 12903302a63e4dd7d9e0dcd054cc2c8fab0e062f..55a4fe28062702aff25808f1077f4b5800baba70 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -520,7 +520,8 @@ fn on_message( } => { let x = x / CLIENT_SCALE; let y = y / CLIENT_SCALE; - for (entity, mut q_player, _transform, _velocity, mut attach) in &mut player_query + for (entity, mut q_player, _transform, _velocity, mut attach) in + &mut player_query { if q_player.addr == *from { if released { @@ -1061,15 +1062,14 @@ fn attach_on_module_tree( }; } let is_player = player_query.contains(this); - let (entity, transform, mut attach, velocity, can_attach) = - if attached_query.contains(this) { - let (entity, _, transform, attach, velocity, can_attach, _, _) = attached_query.get_mut(this).unwrap(); - (entity, *transform, attach, velocity, can_attach) - } - else { - let (entity, _, transform, velocity, attach) = player_query.get_mut(this).unwrap(); - (entity, *transform, attach, velocity, Some(&CanAttach(15))) - }; + let (entity, transform, mut attach, velocity, can_attach) = if attached_query.contains(this) { + let (entity, _, transform, attach, velocity, can_attach, _, _) = + attached_query.get_mut(this).unwrap(); + (entity, *transform, attach, velocity, can_attach) + } else { + let (entity, _, transform, velocity, attach) = player_query.get_mut(this).unwrap(); + (entity, *transform, attach, velocity, Some(&CanAttach(15))) + }; let p_pos = transform.translation; let (rel_x, rel_y) = (p_pos.x - x, p_pos.y - y); @@ -1082,7 +1082,7 @@ fn attach_on_module_tree( let attachable = match can_attach { Some(s) => s.0, - None => return false + None => return false, }; let mut attachment_slot = 5; let mut offset = Vec2::ZERO; @@ -1129,11 +1129,11 @@ fn attach_on_module_tree( let new_transform = Transform::from_xyz( p_pos.x + offset.x * angle.cos() - offset.y * angle.sin(), p_pos.y + offset.x * angle.sin() + offset.y * angle.cos(), - 0. + 0., ) .with_rotation(Quat::from_euler( EulerRot::ZYX, - angle+angle_offset, + angle + angle_offset, 0., 0., )); @@ -1145,7 +1145,9 @@ fn attach_on_module_tree( }; *module.2 = new_transform; module.3.linvel = velocity.linvel; - let joint = FixedJointBuilder::new().local_anchor1(offset).local_basis2(angle_offset); + let joint = FixedJointBuilder::new() + .local_anchor1(offset) + .local_basis2(angle_offset); let mut children = [None, None, None, None]; if let Some(loose_attach) = module.4 { commands.entity(entity).remove::();