~starkingdoms/starkingdoms

d07a0e220233338ddeff36520e4b255a228ca88c — ghostlyzsh 1 year, 11 months ago 96c2b45
detaching fixed
1 files changed, 14 insertions(+), 7 deletions(-)

M server/src/main.rs
M server/src/main.rs => server/src/main.rs +14 -7
@@ 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<ServerEvent>,
) {
    //println!("here");
    for child in attach.children {
        if let Some(child) = child {
            let (mut part_type, attach, children) = attached_query.get_mut(child).unwrap();