From 31dd73cbf59f5c8fe58b77b373a75033dc5a037a Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Tue, 1 Dec 2026 07:57:23 +0400 Subject: fix(fx): switch warbot smoke with the damage alarm Resolve the matching enable and disable selectors from authored CTL alarm groups. Render node-attached smoke and light only while the live Control alarm is active. Verify the native selector against both DLLs and inspect two Vulkan frames around an ordinary AutoDemo alarm. Independent mode-14 triggers and the damage stage cascade remain open. --- crates/fparkan-runtime/src/control_profile.rs | 2 +- crates/fparkan-runtime/src/control_resources.rs | 6 ++++++ crates/fparkan-runtime/src/lib.rs | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'crates/fparkan-runtime') diff --git a/crates/fparkan-runtime/src/control_profile.rs b/crates/fparkan-runtime/src/control_profile.rs index 236d523b..21c54607 100644 --- a/crates/fparkan-runtime/src/control_profile.rs +++ b/crates/fparkan-runtime/src/control_profile.rs @@ -63,7 +63,7 @@ pub(super) fn project_initial( #[derive(Default)] pub(super) struct DamageAlarm { threshold: Option, - active: bool, + pub(super) active: bool, } #[derive(Default)] diff --git a/crates/fparkan-runtime/src/control_resources.rs b/crates/fparkan-runtime/src/control_resources.rs index b9958229..e34a3dfc 100644 --- a/crates/fparkan-runtime/src/control_resources.rs +++ b/crates/fparkan-runtime/src/control_resources.rs @@ -34,6 +34,12 @@ impl Default for Resources { } impl Resources { + pub(super) fn alarm_active(&self, handle: ObjectHandle) -> bool { + self.clocks + .iter() + .any(|(owner, clock)| *owner == handle && clock.alarm.active) + } + pub(super) fn energy_available(&self, handle: ObjectHandle) -> bool { !self.blocked_budgets.contains(&handle) } diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs index 3b097acd..e6fe77af 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -3875,6 +3875,16 @@ pub fn loaded_mission_control_device_tables( .map(|state| state.control_device_tables.as_slice()) } +/// Whether Control has switched this live object into its damage alarm. +#[must_use] +pub fn control_damage_alarm_active(engine: &Engine, handle: ObjectHandle) -> bool { + transform_state(&engine.world, handle).is_ok() + && engine + .loaded + .as_ref() + .is_some_and(|mission| mission.control_resources.alarm_active(handle)) +} + /// Returns the initial prepared Control grouping for full-load mission objects. #[must_use] pub fn loaded_mission_behavior_control_groupings( @@ -8606,6 +8616,7 @@ mod tests { node_data: None, effect_section: PreparedControlEffectSection::Parsed(rows), initial_effect_group, + alarm_effect_rows: Vec::new(), node_effect_links: Vec::new(), effect_modes: Vec::new(), point_list: point_count.map(|count| PreparedControlPointList { @@ -9112,6 +9123,7 @@ mod tests { node_data: None, effect_section, initial_effect_group: None, + alarm_effect_rows: Vec::new(), node_effect_links: Vec::new(), effect_modes: Vec::new(), point_list: None, -- cgit v1.2.3