From f85bb4de01556b03b4b711345acb2bcf3c370502 Mon Sep 17 00:00:00 2001 From: ghostly_zsh Date: Thu, 18 Jun 2026 14:04:52 -0500 Subject: [PATCH] ship editor fix: thruster attachment and connected part sprite --- crates/unified/assets/config/parts/basic_thruster.part.toml | 6 +++--- crates/unified/assets/config/parts/thruster.part.toml | 6 +++--- crates/unified/src/ship_editor/input.rs | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/unified/assets/config/parts/basic_thruster.part.toml b/crates/unified/assets/config/parts/basic_thruster.part.toml index 4c9c8254f8cbf322d27663f9f66750f0eb82757b..80b956a7ec5e73c21b2e2c2a5eaa294507ac217a 100644 --- a/crates/unified/assets/config/parts/basic_thruster.part.toml +++ b/crates/unified/assets/config/parts/basic_thruster.part.toml @@ -19,6 +19,6 @@ exhaust_temperature = 1000.0 heat_constant = 10.0 [[joint]] -id = "Top" -target = { translation = [ 0.0, 55.0, 0.0 ], rotation = 0.0 } -snap = { translation = [ 0.0, 25.0, 0.0 ], rotation = 0.0 } +id = "Bottom" +target = { translation = [ 0.0, -55.0, 0.0 ], rotation = -180.0 } +snap = { translation = [ 0.0, -25.0, 0.0 ], rotation = 0.0 } diff --git a/crates/unified/assets/config/parts/thruster.part.toml b/crates/unified/assets/config/parts/thruster.part.toml index ee305f15cfc6a4b95498b9e215974cad935666c7..a74b5db124621b4f9df73765aacb33aef12e267a 100644 --- a/crates/unified/assets/config/parts/thruster.part.toml +++ b/crates/unified/assets/config/parts/thruster.part.toml @@ -19,6 +19,6 @@ exhaust_temperature = 1000.0 heat_constant = 10.0 [[joint]] -id = "Top" -target = { translation = [ 0.0, 55.0, 0.0 ], rotation = 0.0 } -snap = { translation = [ 0.0, 25.0, 0.0 ], rotation = 0.0 } +id = "Bottom" +target = { translation = [ 0.0, -55.0, 0.0 ], rotation = -180.0 } +snap = { translation = [ 0.0, -25.0, 0.0 ], rotation = 0.0 } diff --git a/crates/unified/src/ship_editor/input.rs b/crates/unified/src/ship_editor/input.rs index 99f91eb47b598e4ff7ce7e1512c27d76832a9e72..ab17bc9999b12d5406ac62303e5d6c66c0d0675c 100644 --- a/crates/unified/src/ship_editor/input.rs +++ b/crates/unified/src/ship_editor/input.rs @@ -78,7 +78,7 @@ fn on_click( mut drag: ResMut, camera: Single<&Transform, (With, With)>, window: Single<&Window, With>, - mut ghost_module: Query<(Entity, &mut Transform, &mut Sprite, &Joints), (With, Without)>, + mut ghost_module: Query<(Entity, &mut Transform, &mut Sprite, &Joints, &PartConfigHolder), (With, Without)>, snaps: Query<(&SnapOf, &SnapOfJoint)>, joints: Query<(&Joint, &JointOf, &Transform, Option<&Peer>, Entity), (Without, Without)>, mut parts: Query< @@ -104,7 +104,7 @@ fn on_click( drag.is_dragging = false; if let Some(snap_target) = drag.target && let Some(peer_snap) = drag.peer { - let Ok((ghost_entity, mut ghost_transform, mut ghost_sprite, ghost_joints)) = ghost_module.single_mut() else { return }; + let Ok((ghost_entity, mut ghost_transform, mut ghost_sprite, ghost_joints, ghost_config)) = ghost_module.single_mut() else { return }; let Ok((target_snap_part, target_snap_joint)) = snaps.get(snap_target) else { return; }; @@ -152,6 +152,7 @@ fn on_click( * Quat::from_rotation_z(PI as f32); debug!("spawning part"); + ghost_sprite.image = asset_server.load(ghost_config.0.part.sprite_connected.clone()); ghost_sprite.color = Color::srgb(1.0, 1.0, 1.0); commands.entity(ghost_entity) .insert(Part)