From f0a92313d0628eda8e163ab0608ce8fcbedaad95 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Nov 2026 07:21:39 +0400 Subject: feat(combat): show detached assemblies after chassis destruction --- crates/fparkan-runtime/src/destruction.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'crates/fparkan-runtime/src/destruction.rs') diff --git a/crates/fparkan-runtime/src/destruction.rs b/crates/fparkan-runtime/src/destruction.rs index 38a4e38f..89688de5 100644 --- a/crates/fparkan-runtime/src/destruction.rs +++ b/crates/fparkan-runtime/src/destruction.rs @@ -1,10 +1,12 @@ //! Presentation events for projectile damage that destroys a unit. use crate::{autodemo::MOBILE_UNIT, Engine, MissionControlDeviceTableState, ObjectHandle}; -use fparkan_world::transform_state; +use fparkan_world::{identity_metadata, transform_state}; /// Position and attached EXPL resource of a chassis at lethal contact. pub struct UnitDestructionEffect { + /// Prepared draft index for the destroyed actor when it has an authored layout. + pub object_index: Option, /// World-space origin of the destroyed chassis. pub position: [f32; 3], /// Archive containing the explosion description. @@ -60,11 +62,21 @@ pub(super) fn pending_effect( .iter() .find(|table| table.handle == handle)?; let (archive, name) = root_effect(table)?; + let object_index = identity_metadata(&engine.world, handle) + .ok() + .and_then(|identity| identity.original_id) + .and_then(|id| { + mission + .object_drafts + .iter() + .position(|draft| draft.original_id == Some(id)) + }); let position = transform_state(&engine.world, handle) .ok()? .position .map(f32::from_bits); Some(UnitDestructionEffect { + object_index, position, archive, name, -- cgit v1.2.3