From 34e4a91c02854609d8c922d8a9a0a7963bb6a9dd Mon Sep 17 00:00:00 2001 From: core Date: Wed, 19 Nov 2025 19:33:13 -0500 Subject: [PATCH] fix: detachment --- crates/unified/src/server/player.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/unified/src/server/player.rs b/crates/unified/src/server/player.rs index 60dca4d1ecf7a5565bfb1874727a853e362b1ddb..08536a946c29e8bae6962d0ae4e814cc4af4fb35 100644 --- a/crates/unified/src/server/player.rs +++ b/crates/unified/src/server/player.rs @@ -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::(); // 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::(); + //commands.entity(other_joint_of.0).remove::(); 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::(); commands.entity(entity).insert(PartiallyDisconnected); - commands.entity(entity).remove::(); } fn dragging(