@@ 478,11 478,13 @@ fn on_message(
if let Some(loose_attach) = module.4 {
commands.entity(entity).remove::<LooseAttach>();
if *module.1 == PartType::LandingThruster {
- commands.entity(loose_attach.children[2].unwrap()).insert(Attach {
- associated_player: attach.associated_player,
- parent: Some(entity),
- children: [None, None, None, None]
- });
+ commands
+ .entity(loose_attach.children[2].unwrap())
+ .insert(Attach {
+ associated_player: attach.associated_player,
+ parent: Some(entity),
+ children: [None, None, None, None],
+ });
}
children = loose_attach.children;
}
@@ 496,7 498,10 @@ fn on_message(
attach.children[2] = Some(module.0);
if *module.1 == PartType::LandingThruster {
let loose_attach = module.4.unwrap().clone();
- let mut transform = part_query.get_mut(loose_attach.children[2].unwrap()).unwrap().2;
+ let mut transform = part_query
+ .get_mut(loose_attach.children[2].unwrap())
+ .unwrap()
+ .2;
transform.translation = vec3(
p_pos.x + 53. / SCALE * angle.sin(),
p_pos.y - 53. / SCALE * angle.cos(),
@@ 517,12 522,8 @@ fn on_message(
p_pos.y + 53. / SCALE * angle.cos(),
0.,
);
- module.2.rotation = Quat::from_euler(
- EulerRot::ZYX,
- angle + PI,
- 0.,
- 0.,
- );
+ module.2.rotation =
+ Quat::from_euler(EulerRot::ZYX, angle + PI, 0., 0.);
module.3.linvel = velocity.linvel;
let joint = FixedJointBuilder::new()
.local_anchor1(vec2(0. / SCALE, 53. / SCALE));
@@ 530,11 531,13 @@ fn on_message(
if let Some(loose_attach) = module.4 {
commands.entity(entity).remove::<LooseAttach>();
if *module.1 == PartType::LandingThruster {
- commands.entity(loose_attach.children[2].unwrap()).insert(Attach {
- associated_player: attach.associated_player,
- parent: Some(entity),
- children: [None, None, None, None]
- });
+ commands
+ .entity(loose_attach.children[2].unwrap())
+ .insert(Attach {
+ associated_player: attach.associated_player,
+ parent: Some(entity),
+ children: [None, None, None, None],
+ });
}
children = loose_attach.children;
}
@@ 548,7 551,10 @@ fn on_message(
attach.children[0] = Some(module.0);
if *module.1 == PartType::LandingThruster {
let loose_attach = module.4.unwrap().clone();
- let mut transform = part_query.get_mut(loose_attach.children[2].unwrap()).unwrap().2;
+ let mut transform = part_query
+ .get_mut(loose_attach.children[2].unwrap())
+ .unwrap()
+ .2;
transform.translation = vec3(
p_pos.x - 53. / SCALE * angle.sin(),
p_pos.y + 53. / SCALE * angle.cos(),
@@ 583,11 589,13 @@ fn on_message(
if let Some(loose_attach) = module.4 {
commands.entity(entity).remove::<LooseAttach>();
if *module.1 == PartType::LandingThruster {
- commands.entity(loose_attach.children[2].unwrap()).insert(Attach {
- associated_player: attach.associated_player,
- parent: Some(entity),
- children: [None, None, None, None]
- });
+ commands
+ .entity(loose_attach.children[2].unwrap())
+ .insert(Attach {
+ associated_player: attach.associated_player,
+ parent: Some(entity),
+ children: [None, None, None, None],
+ });
}
children = loose_attach.children;
}
@@ 601,14 609,21 @@ fn on_message(
attach.children[1] = Some(module.0);
if *module.1 == PartType::LandingThruster {
let loose_attach = module.4.unwrap().clone();
- let mut transform = part_query.get_mut(loose_attach.children[2].unwrap()).unwrap().2;
+ let mut transform = part_query
+ .get_mut(loose_attach.children[2].unwrap())
+ .unwrap()
+ .2;
transform.translation = vec3(
p_pos.x + 53. / SCALE * angle.cos(),
p_pos.y + 53. / SCALE * angle.sin(),
0.,
);
- transform.rotation =
- Quat::from_euler(EulerRot::ZYX, angle + (PI / 2.), 0., 0.);
+ transform.rotation = Quat::from_euler(
+ EulerRot::ZYX,
+ angle + (PI / 2.),
+ 0.,
+ 0.,
+ );
}
break;
} else if attach.children[3] == None
@@ 636,11 651,13 @@ fn on_message(
if let Some(loose_attach) = module.4 {
commands.entity(entity).remove::<LooseAttach>();
if *module.1 == PartType::LandingThruster {
- commands.entity(loose_attach.children[2].unwrap()).insert(Attach {
- associated_player: attach.associated_player,
- parent: Some(entity),
- children: [None, None, None, None]
- });
+ commands
+ .entity(loose_attach.children[2].unwrap())
+ .insert(Attach {
+ associated_player: attach.associated_player,
+ parent: Some(entity),
+ children: [None, None, None, None],
+ });
}
children = loose_attach.children;
}
@@ 654,14 671,21 @@ fn on_message(
attach.children[3] = Some(module.0);
if *module.1 == PartType::LandingThruster {
let loose_attach = module.4.unwrap().clone();
- let mut transform = part_query.get_mut(loose_attach.children[2].unwrap()).unwrap().2;
+ let mut transform = part_query
+ .get_mut(loose_attach.children[2].unwrap())
+ .unwrap()
+ .2;
transform.translation = vec3(
p_pos.x - 53. / SCALE * angle.cos(),
p_pos.y - 53. / SCALE * angle.sin(),
0.,
);
- transform.rotation =
- Quat::from_euler(EulerRot::ZYX, angle - (PI / 2.), 0., 0.);
+ transform.rotation = Quat::from_euler(
+ EulerRot::ZYX,
+ angle - (PI / 2.),
+ 0.,
+ 0.,
+ );
}
break;
}
@@ 675,7 699,9 @@ fn on_message(
commands.entity(select).insert(LooseAttach {
children: module.3.children,
});
- commands.entity(module.3.children[2].unwrap()).remove::<Attach>();
+ commands
+ .entity(module.3.children[2].unwrap())
+ .remove::<Attach>();
} else {
detach_recursive(
&mut commands,
@@ 842,7 868,9 @@ fn detach_recursive(
commands.entity(entity).insert(LooseAttach {
children: attach.children,
});
- commands.entity(attach.children[2].unwrap()).remove::<Attach>();
+ commands
+ .entity(attach.children[2].unwrap())
+ .remove::<Attach>();
continue;
} else if *part_type == PartType::LandingThrusterSuspension {
let parent = attach.parent.unwrap();
@@ 937,11 965,13 @@ fn attach_on_module_tree(
if let Some(loose_attach) = loose_attach {
commands.entity(entity).remove::<LooseAttach>();
if *module.1 == PartType::LandingThruster {
- commands.entity(loose_attach.children[2].unwrap()).insert(Attach {
- associated_player: attach.associated_player,
- parent: Some(entity),
- children: [None, None, None, None]
- });
+ commands
+ .entity(loose_attach.children[2].unwrap())
+ .insert(Attach {
+ associated_player: attach.associated_player,
+ parent: Some(entity),
+ children: [None, None, None, None],
+ });
}
children = loose_attach.children;
}
@@ 976,11 1006,13 @@ fn attach_on_module_tree(
if let Some(loose_attach) = loose_attach {
commands.entity(entity).remove::<LooseAttach>();
if *module.1 == PartType::LandingThruster {
- commands.entity(loose_attach.children[2].unwrap()).insert(Attach {
- associated_player: attach.associated_player,
- parent: Some(entity),
- children: [None, None, None, None]
- });
+ commands
+ .entity(loose_attach.children[2].unwrap())
+ .insert(Attach {
+ associated_player: attach.associated_player,
+ parent: Some(entity),
+ children: [None, None, None, None],
+ });
}
children = loose_attach.children;
}
@@ 1015,11 1047,13 @@ fn attach_on_module_tree(
if let Some(loose_attach) = loose_attach {
commands.entity(entity).remove::<LooseAttach>();
if *module.1 == PartType::LandingThruster {
- commands.entity(loose_attach.children[2].unwrap()).insert(Attach {
- associated_player: attach.associated_player,
- parent: Some(entity),
- children: [None, None, None, None]
- });
+ commands
+ .entity(loose_attach.children[2].unwrap())
+ .insert(Attach {
+ associated_player: attach.associated_player,
+ parent: Some(entity),
+ children: [None, None, None, None],
+ });
}
children = loose_attach.children;
}
@@ 1044,7 1078,9 @@ fn attach_on_module_tree(
attached_query,
part_query,
)
- } else { false };
+ } else {
+ false
+ };
}
}
return ret;
@@ 1174,6 1210,7 @@ fn convert_modules_recursive(
.local_anchor1(Vec2::new(0., 0.))
.local_anchor2(Vec2::new(0., 0.))
.motor_position(0., 150., 10.)
+ .limits([0., 50. / SCALE])
.build();
let mut suspension = commands.spawn(PartBundle {
transform: TransformBundle::from(*module_transform),