@@ 819,7 819,7 @@ fn convert_modules(
planet_query: Query<(Entity, &PlanetType, &Children)>,
player_query: Query<&Attach, With<Player>>,
mut attached_query: Query<(&mut PartType, &Attach, &Children), Without<Player>>,
- mut collider_query: Query<(&mut Collider, &mut Transform)>,
+ mut collider_query: Query<(&mut Collider, &mut Transform, &Parent)>,
mut packet_send: EventWriter<ServerEvent>,
) {
for (_planet_entity, planet_type, children) in &planet_query {
@@ 841,6 841,18 @@ fn convert_modules(
.1
.associated_player
.unwrap()
+ } else if collider_query.contains(other) {
+ let parent = collider_query.get(other).unwrap().2.get();
+ if attached_query.contains(parent) {
+ attached_query
+ .get(parent)
+ .unwrap()
+ .1
+ .associated_player
+ .unwrap()
+ } else {
+ continue;
+ }
} else {
continue;
};
@@ 861,10 873,9 @@ fn convert_modules_recursive(
planet_type: PlanetType,
attach: Attach,
attached_query: &mut Query<(&mut PartType, &Attach, &Children), Without<Player>>,
- collider_query: &mut Query<(&mut Collider, &mut Transform)>,
+ collider_query: &mut Query<(&mut Collider, &mut Transform, &Parent)>,
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();
@@ 872,7 883,7 @@ fn convert_modules_recursive(
match planet_type {
PlanetType::Moon => {
*part_type = PartType::Hub;
- let (mut collider, mut transform) =
+ let (mut collider, mut transform, _) =
collider_query.get_mut(*children.first().unwrap()).unwrap();
*collider =
Collider::cuboid(PART_HALF_SIZE / SCALE, PART_HALF_SIZE / SCALE);