aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/projectile.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 12:53:28 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 12:53:28 +0300
commit5ad056292d91bd6a38299c5d890a975a435c8422 (patch)
tree7eab6807a8af1502ec3dffdcc167a904b0720607 /crates/fparkan-runtime/src/projectile.rs
parent16d25bd46e16d38e22cab7972ae6ac65196b3e0f (diff)
downloadfparkan-5ad056292d91bd6a38299c5d890a975a435c8422.tar.xz
fparkan-5ad056292d91bd6a38299c5d890a975a435c8422.zip
feat(player): lower the communicator field on capture
Drive the original CTLD type-13 tracks from the local capture. The Constructor window replay shows the raised and lowered field and four player projectiles stop at the mesh. Leaving resumes the authored open pose. Motion timing and exit trigger remain approximate.
Diffstat (limited to 'crates/fparkan-runtime/src/projectile.rs')
-rw-r--r--crates/fparkan-runtime/src/projectile.rs23
1 files changed, 14 insertions, 9 deletions
diff --git a/crates/fparkan-runtime/src/projectile.rs b/crates/fparkan-runtime/src/projectile.rs
index 48018933..fc9f6965 100644
--- a/crates/fparkan-runtime/src/projectile.rs
+++ b/crates/fparkan-runtime/src/projectile.rs
@@ -1,6 +1,6 @@
use crate::{
apply_loaded_mission_control_node_delta,
- projectile_parts::{chassis_part_contact, root_model, root_triangle_hit},
+ projectile_parts::{chassis_part_contact, root_model},
ControlResourceAccessError, Engine, MissionAssets, MissionControlNodeProviderTableStatus,
TerrainWorld, CONTROL_CLASS_SOURCE_BULL, UNIT_DAT_CONTROL_CLASS_HIGH_BIT,
};
@@ -189,6 +189,8 @@ pub enum ProjectileNode {
Building(u32),
/// A node of the warbot's chassis model.
Chassis(u32),
+ /// An indestructible communicator field.
+ CaptureBarrier,
}
impl ProjectileContact {
@@ -229,9 +231,10 @@ pub fn projectile_unit_hit(
let (center, radius) = unit_sphere(&mission.mission_assets, index, state)?;
let sphere_fraction = segment_sphere_fraction(segment, center, radius)?;
let (fraction, node) = if building {
- let (fraction, node) =
- root_triangle_hit(&mission.mission_assets, index, state, segment, |_| true)?;
- (fraction, Some(ProjectileNode::Building(node)))
+ let (fraction, node) = crate::capture_barrier::projectile_contact(
+ mission, index, handle, state, segment,
+ )?;
+ (fraction, Some(node))
} else if class == super::boarding::WARBOT_CLASS {
chassis_part_contact(
mission,
@@ -279,6 +282,11 @@ pub fn apply_projectile_contact(
contact: ProjectileContact,
volume: f32,
) -> Result<Option<(f32, bool)>, ControlResourceAccessError> {
+ let key = match contact.node {
+ Some(ProjectileNode::CaptureBarrier) => return Ok(None),
+ None | Some(ProjectileNode::Chassis(0)) => None,
+ Some(ProjectileNode::Chassis(key) | ProjectileNode::Building(key)) => Some(key),
+ };
let volume = super::projectile_shield::absorb(engine, contact, volume);
let table = engine.loaded.as_ref().and_then(|mission| {
mission
@@ -290,11 +298,8 @@ pub fn apply_projectile_contact(
volume,
table.and_then(|table| table.projectile_resistance_bits),
);
- let key = match contact.node {
- None | Some(ProjectileNode::Chassis(0)) => {
- return apply_projectile_hit(engine, contact.handle, volume);
- }
- Some(ProjectileNode::Chassis(key) | ProjectileNode::Building(key)) => key,
+ let Some(key) = key else {
+ return apply_projectile_hit(engine, contact.handle, volume);
};
let row = table.and_then(|table| super::control_node_provider_row(table, key).ok());
let Some(row) = row else {