@@ 69,6 69,7 @@ fn complete_partial_disconnects(
// trigger a disconnect on them to propagate the disconnection
let mut disconnect_queue = vec![];
+ commands.entity(partially_disconnected_part).remove::<PartInShip>(); // they're no longer in the ship, remove them from the meta
disconnect_part(
(partially_disconnected_part, match q_joints.get(partially_disconnected_part) {
Ok(j) => j,
@@ 101,6 102,12 @@ fn can_reach_hearty(
is_top_of_recursion: bool
) -> bool {
+ // Are we hearty?
+ if let Ok(Some(_)) = q_is_hearty.get(part) {
+ debug!("partial detach DFS: visited {} joints => we are hearty! @ {:?}", visited_joints.len(), part);
+ return true;
+ }
+
// Get the joints of this entity
let Ok(our_joints) = q_joints.get(part).cloned() else {
warn!("part does not have a Joints? this should be impossible...");
@@ 152,7 159,7 @@ fn can_reach_hearty(
debug!("-> via {:?}", part);
return true;
} else {
- // lame. continue to next part
+ // lame. continue to next part, and remove PartInShip as they're not connected anymore
continue 'to_next_joint;
}
}
@@ 208,7 215,7 @@ fn disconnect_part(
let Ok(other_joints) = q_only_joints.get(other_joint_of.0) else {
continue
};
- commands.entity(other_joint_of.0).remove::<PartInShip>();
+ //commands.entity(other_joint_of.0).remove::<PartInShip>();
if !processed_peers.contains(&peer.peer_joint_entity_id) {
disconnect_part((other_joint_of.0, joints), q_joints,
@@ 218,8 225,8 @@ fn disconnect_part(
processed_peers.push(peer.peer_joint_entity_id);
}
// recursive disconnect part
+ //commands.entity(entity).remove::<PartInShip>();
commands.entity(entity).insert(PartiallyDisconnected);
- commands.entity(entity).remove::<PartInShip>();
}
fn dragging(