From 364f8a0984e5cd3b65e81f24e95fcf8cd92aec2d Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Tue, 1 Dec 2026 07:34:52 +0400 Subject: fix(combat): apply critical damage on the Control resource tick Use the alarm entry amount for sequential wear and disable the onboard repair device before recomputing motion limits. Match the Control.dll alarm and recovery vector. In the stock AutoDemo the affected warbot now loses its remaining movement instead of keeping its last limit. Alarm effects and the full native node cascade remain approximate. --- crates/fparkan-runtime/src/destruction.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (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 7ed316da..aa02197b 100644 --- a/crates/fparkan-runtime/src/destruction.rs +++ b/crates/fparkan-runtime/src/destruction.rs @@ -1,10 +1,23 @@ -//! Presentation events for projectile damage that destroys a unit. +//! Destruction lifecycle and presentation events for damaged units. use crate::{ - autodemo::MOBILE_UNIT, Engine, MissionControlDeviceTableState, MissionControlNodeProviderRow, - MissionControlNodeProviderTableStatus, ObjectHandle, UNIT_DAT_CONTROL_CLASS_HIGH_BIT, + autodemo::MOBILE_UNIT, ControlResourceAccessError, Engine, MissionControlDeviceTableState, + MissionControlNodeProviderRow, MissionControlNodeProviderTableStatus, ObjectHandle, + UNIT_DAT_CONTROL_CLASS_HIGH_BIT, }; -use fparkan_world::{identity_metadata, transform_state}; +use fparkan_world::{identity_metadata, request_delete, transform_state}; + +pub(super) fn destroy( + engine: &mut Engine, + handle: ObjectHandle, +) -> Result<(), ControlResourceAccessError> { + let effect = pending_effect(engine, handle); + request_delete(&mut engine.world, handle).map_err(ControlResourceAccessError::World)?; + if let (Some(effect), Some(events)) = (effect, engine.destruction_effects.as_mut()) { + events.push(effect); + } + Ok(()) +} /// Geometry supplied by the destroyed object to its authored explosion. pub enum DestroyedMesh { -- cgit v1.2.3