aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/destruction.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 08:24:02 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 08:24:02 +0300
commitce4fdc768602efe7c621e631c1390d8d76248505 (patch)
tree9a5908319ea16bebe3e3bd17c4f23c72edaf89ef /crates/fparkan-runtime/src/destruction.rs
parent25f0b76a10dbd5ac2cfabd5354f621ae82cf19b4 (diff)
downloadfparkan-ce4fdc768602efe7c621e631c1390d8d76248505.tar.xz
fparkan-ce4fdc768602efe7c621e631c1390d8d76248505.zip
feat(combat): apply projectile hits to chassis nodes
Use prepared chassis triangles to choose a loaded NDP node. Exhausted ordinary parts play their authored EXPL independently of root death. Unresolved mounted geometry keeps a sphere contact on exit. A stock side-shot fixture exhausts a heavy chassis part while the hull survives.
Diffstat (limited to 'crates/fparkan-runtime/src/destruction.rs')
-rw-r--r--crates/fparkan-runtime/src/destruction.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/fparkan-runtime/src/destruction.rs b/crates/fparkan-runtime/src/destruction.rs
index 50f307fa..8fb3a1bf 100644
--- a/crates/fparkan-runtime/src/destruction.rs
+++ b/crates/fparkan-runtime/src/destruction.rs
@@ -32,7 +32,7 @@ pub fn take_unit_destruction_effects(engine: &mut Engine) -> Vec<UnitDestruction
.unwrap_or_default()
}
-/// Explosion descriptors for prepared mobile chassis and damageable building parts.
+/// Explosion descriptors for prepared chassis roots and damageable model parts.
pub fn unit_destruction_effect_sources(
engine: &Engine,
) -> impl Iterator<Item = (String, String)> + '_ {
@@ -54,6 +54,8 @@ pub fn unit_destruction_effect_sources(
};
Some(if class & UNIT_DAT_CONTROL_CLASS_HIGH_BIT != 0 {
rows.as_slice()
+ } else if class == super::boarding::WARBOT_CLASS {
+ &rows[..rows.partition_point(|row| row.unit_component_index == 0)]
} else if class & MOBILE_UNIT != 0 {
rows.get(..1).unwrap_or_default()
} else {
@@ -64,7 +66,7 @@ pub fn unit_destruction_effect_sources(
})
}
-pub(super) fn building_part_effect(
+pub(super) fn part_effect(
row: &MissionControlNodeProviderRow,
position: [f32; 3],
) -> Option<UnitDestructionEffect> {