diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-26 08:42:38 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-26 08:42:38 +0300 |
| commit | 2f75b9792c98c4d32b0349810080dd226357b505 (patch) | |
| tree | a49b82684c095bf2b54523262cdf3edf4b3ce824 /crates/fparkan-runtime/src/projectile.rs | |
| parent | 5844c9b0f4216da47cf03894b34f9a150fd5b170 (diff) | |
| download | fparkan-2f75b9792c98c4d32b0349810080dd226357b505.tar.xz fparkan-2f75b9792c98c4d32b0349810080dd226357b505.zip | |
feat(render): throw detached chassis nodes as fragments
Pass the depleted node to an authored Op10 with a built-in mesh request. Reuse its existing draw ranges for the flight and keep the hull alive. The fixed-camera fixture shows the heavy track section separate and rotate after impact.
Diffstat (limited to 'crates/fparkan-runtime/src/projectile.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/projectile.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/fparkan-runtime/src/projectile.rs b/crates/fparkan-runtime/src/projectile.rs index 70c9ab77..d4f23243 100644 --- a/crates/fparkan-runtime/src/projectile.rs +++ b/crates/fparkan-runtime/src/projectile.rs @@ -313,7 +313,7 @@ pub fn apply_projectile_contact( } // shortcut: feed the projectile NDP volume into the native reduction while impact falloff is open. let effect = (volume >= remaining && engine.destruction_effects.is_some()) - .then(|| super::destruction::part_effect(row, contact.position)) + .then(|| super::destruction::part_effect(engine, row, contact)) .flatten(); let updated = apply_loaded_mission_control_node_delta(engine, contact.handle, key, -volume)?; if updated.is_some() { @@ -465,6 +465,9 @@ mod tests { let effects = take_unit_destruction_effects(&mut engine); assert_eq!(effects.len(), 1); assert_eq!(effects[0].position, contact.position); + assert!( + matches!(effects[0].mesh, Some(crate::DestroyedMesh::ChassisNode { object_index: 14, node: key, .. }) if key == node as usize) + ); } #[test] @@ -515,7 +518,7 @@ mod tests { panic!("expected one EXPL at the failed part"); }; assert_eq!(effect.position, contact.position); - assert_eq!(effect.object_index, None); + assert!(effect.mesh.is_none()); assert_eq!(effect.name, "explode_frt_b.exp"); assert!(unit_destruction_effect_sources(&engine) .any(|source| source == (effect.archive.clone(), effect.name.clone()))); |
