From f626d7759e371ba29efbb733c394751fea547d04 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Nov 2026 23:11:31 +0400 Subject: fix(combat): show muzzle flashes for manual fire Send the player's linked Control row through the existing firing flash sampler. On the stock Constructor start, the 25 mm cannon emits the authored sprite and a light at the muzzle from an external camera. Full node-driven mode-4 phase remains open. --- crates/fparkan-runtime/src/player_weapon.rs | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'crates/fparkan-runtime/src/player_weapon.rs') diff --git a/crates/fparkan-runtime/src/player_weapon.rs b/crates/fparkan-runtime/src/player_weapon.rs index 0ab0613f..8e350d16 100644 --- a/crates/fparkan-runtime/src/player_weapon.rs +++ b/crates/fparkan-runtime/src/player_weapon.rs @@ -28,7 +28,7 @@ pub struct PlayerWeapon { pub projectile_archive: String, /// Optional type-4 effect started by this weapon. pub effect: Option<(String, String)>, - pub(super) effect_row: Option<(usize, usize)>, + effect_row: Option<(usize, usize)>, windup_sound_rows: Vec<(usize, usize)>, windup_started: bool, barrels: Vec, @@ -230,6 +230,17 @@ impl PlayerWeapon { shot } + /// The Control effect instance bound to this weapon's release. + pub fn firing_effect(&self, object_index: usize) -> Option { + self.effect_row + .map(|(table_index, row_index)| FiringEffectInstance { + object_index, + component_index: self.component_index, + table_index, + row_index, + }) + } + /// Prepared node-attached sound rows belonging to this device. pub fn windup_sounds( &self, @@ -477,7 +488,7 @@ mod tests { projectile: String::from("test"), projectile_archive: String::from("test.rlb"), effect: None, - effect_row: None, + effect_row: Some((2, 3)), windup_sound_rows: vec![(0, 1)], windup_started: false, barrels: vec![Barrel { @@ -535,7 +546,17 @@ mod tests { assert!(weapons.fire(false, 10).next().is_none()); weapons.apply_firing_pose(0, &mut node_times); assert_eq!(node_times, [Some(6.0)]); - assert_eq!(weapons.fire(false, 11).next().unwrap().0, 0); + let (slot, weapon, _) = weapons.fire(false, 11).next().unwrap(); + assert_eq!(slot, 0); + assert_eq!( + weapon.firing_effect(7), + Some(FiringEffectInstance { + object_index: 7, + component_index: 0, + table_index: 2, + row_index: 3, + }) + ); assert!(weapons.fire(false, 16).next().is_none()); weapons.apply_firing_pose(0, &mut node_times); assert_eq!(node_times, [Some(7.0)]); -- cgit v1.2.3