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 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'crates/fparkan-fx/src/clock.rs') 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 { -- cgit v1.2.3