From 5fee115996fdbb9235e96289c74c6b8f0244ebd6 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 14 Nov 2026 19:29:08 +0400 Subject: fix(fx): keep damage effects dormant on intact objects --- crates/fparkan-fx/src/clock.rs | 17 +++++++++++++++++ crates/fparkan-fx/src/smoke.rs | 2 +- crates/fparkan-runtime/src/lib.rs | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 'crates') diff --git a/crates/fparkan-fx/src/clock.rs b/crates/fparkan-fx/src/clock.rs index bce7424f..76a6f5b1 100644 --- a/crates/fparkan-fx/src/clock.rs +++ b/crates/fparkan-fx/src/clock.rs @@ -20,6 +20,23 @@ pub struct FxPhaseProvider { } impl FxPhaseProvider { + /// Supplies Control selector 0x31 from the owner's total remaining capacity. + pub fn with_control_capacity(mut self, remaining: f32, capacity: f32) -> Option { + let health = remaining / capacity; + if !remaining.is_finite() || !capacity.is_finite() || capacity <= 0.0 || !health.is_finite() + { + return None; + } + self.health = health; + Some(self) + } + + /// Applies the instance's damage activation approximation before command jitter. + pub fn control_effect_active(&self, time_mode: u32) -> bool { + // shortcut: activate mode 14 on aggregate damage until the native activation path is wired. + time_mode != 14 || self.health < 1.0 + } + /// Explicit preview stub: stationary, healthy, with complementary values at one. /// Unit limits are neutral denominators until live owner data is connected. pub const fn idle() -> Self { diff --git a/crates/fparkan-fx/src/smoke.rs b/crates/fparkan-fx/src/smoke.rs index 116dcb77..1cc06567 100644 --- a/crates/fparkan-fx/src/smoke.rs +++ b/crates/fparkan-fx/src/smoke.rs @@ -115,7 +115,7 @@ impl SmokeEmitterState { } /// Resets the three streams and the native pool state. - fn reset(&mut self) { + pub fn reset(&mut self) { self.emitter_rng = self.initial_emitter_rng; self.signed_rng = self.initial_signed_rng; self.material_rng = self.initial_material_rng; diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs index 614d235b..65e808fa 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -2784,7 +2784,7 @@ pub fn frame_with_player_motion( /// Coverage entries for the subsystems still absent from the mission loop. pub const SIMULATION_COVERAGE: &str = - "sim_coverage research_startup_gate_stub=1 mission_handlers_stub=1 unit_behavior_stub=1 render_object_lifecycle_stub=1 render_winding_change_stub=1 mission_event_clock_approx=1 mission_tactical_ids_stub=1 mission_clan_roster_stub=1 mission_message_ui_stub=1 factory_orders_approx=1 mine_orders_approx=1 mission_patrol_approx=1 mission_hero_exit_approx=1 laboratory_research_approx=1 building_projectile_approx=1"; + "sim_coverage research_startup_gate_stub=1 mission_handlers_stub=1 unit_behavior_stub=1 render_object_lifecycle_stub=1 render_winding_change_stub=1 control_damage_fx_activation_approx=1 mission_event_clock_approx=1 mission_tactical_ids_stub=1 mission_clan_roster_stub=1 mission_message_ui_stub=1 factory_orders_approx=1 mine_orders_approx=1 mission_patrol_approx=1 mission_hero_exit_approx=1 laboratory_research_approx=1 building_projectile_approx=1"; /// Totals from a headless mission coverage run. #[derive(Clone, Debug, Eq, PartialEq)] -- cgit v1.2.3