From d07a0e220233338ddeff36520e4b255a228ca88c Mon Sep 17 00:00:00 2001 From: ghostlyzsh Date: Thu, 4 Jan 2024 17:36:31 -0600 Subject: [PATCH] detaching fixed --- server/src/main.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/server/src/main.rs b/server/src/main.rs index 59c6043325f651837dbae3636a184e6ed2a8ef1a..0ffc63f9c93a246dad13b7ce0e596c3e260b51d7 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -546,16 +546,22 @@ fn on_message( &mut attached_query, ); if attached_query.contains(parent) { - let mut parent_attach = - attached_query.get_mut(parent).unwrap().3; - let children = parent_attach.children.clone(); - for (i, child) in children.iter().enumerate() { - if let Some(child) = child { - if *child == entity { - parent_attach.children[i] = None; + { + let mut parent_attach = + attached_query.get_mut(parent).unwrap().3; + let children = parent_attach.children.clone(); + for (i, child) in children.iter().enumerate() { + if let Some(child) = child { + if *child == select { + parent_attach.children[i] = None; + } } } } + let mut module = + attached_query.get_mut(select).unwrap(); + module.2.translation = + vec3(x / SCALE, y / SCALE, 0.); } else { for (i, child) in attach.children.clone().iter().enumerate() { @@ -843,6 +849,7 @@ fn convert_modules_recursive( collider_query: &mut Query<(&mut Collider, &mut Transform)>, packet_send: &mut EventWriter, ) { + //println!("here"); for child in attach.children { if let Some(child) = child { let (mut part_type, attach, children) = attached_query.get_mut(child).unwrap();