From 9e32164288a31f45041247ae4744c6461472e226 Mon Sep 17 00:00:00 2001 From: ghostlyzsh Date: Sat, 6 Jan 2024 17:02:48 -0600 Subject: [PATCH] stronger module break off --- server/src/main.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/server/src/main.rs b/server/src/main.rs index 35dfa4c4b40887807d3849f460bf2b9ed3a1f4e5..cc671b1861e23cd592e397e2068ba8e74d3a03c9 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -76,7 +76,10 @@ fn main() { .add_systems(Update, on_message) .add_systems(Update, on_close) .add_systems(FixedUpdate, on_position_change) - .add_systems(FixedUpdate, (break_modules, gravity_update, player_input_update).chain()) + .add_systems( + FixedUpdate, + (break_modules, gravity_update, player_input_update).chain(), + ) .add_systems(FixedUpdate, convert_modules) //.insert_resource(Time::::from_seconds(1.0/20.0)) .run(); @@ -1311,10 +1314,12 @@ fn break_modules( let joints = rapier_context.entity2impulse_joint(); let mut detach_list = Vec::new(); for (entity, part_type, _, attach, _, _, _) in &mut attached_query { - if *part_type == PartType::LandingThrusterSuspension { continue } + if *part_type == PartType::LandingThrusterSuspension { + continue; + } let handle = joints.get(&entity).unwrap(); let joint = rapier_context.impulse_joints.get(*handle).unwrap(); - if joint.impulses.magnitude() > 0.00001 { + if joint.impulses.magnitude() > 0.00005 { detach_list.push((entity, *part_type, attach.clone())); } } @@ -1329,11 +1334,7 @@ fn break_modules( .entity(attach.children[2].unwrap()) .remove::(); } else { - detach_recursive( - &mut commands, - attach.clone(), - &mut attached_query, - ); + detach_recursive(&mut commands, attach.clone(), &mut attached_query); } let parent = attach.parent.unwrap(); if attached_query.contains(parent) {