aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/destruction.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-01 06:34:52 +0300
committerValentin Popov <valentin@popov.link>2026-12-01 06:34:52 +0300
commit364f8a0984e5cd3b65e81f24e95fcf8cd92aec2d (patch)
tree24734f764a565d376051b322619a6a4c82758601 /crates/fparkan-runtime/src/destruction.rs
parentc83b6fcdc97a193184552b436086a76679d024ba (diff)
downloadfparkan-364f8a0984e5cd3b65e81f24e95fcf8cd92aec2d.tar.xz
fparkan-364f8a0984e5cd3b65e81f24e95fcf8cd92aec2d.zip
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.
Diffstat (limited to 'crates/fparkan-runtime/src/destruction.rs')
-rw-r--r--crates/fparkan-runtime/src/destruction.rs21
1 files changed, 17 insertions, 4 deletions
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 {