diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-01 06:57:23 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-01 06:57:23 +0300 |
| commit | 31dd73cbf59f5c8fe58b77b373a75033dc5a037a (patch) | |
| tree | 7a20ada1d75679b61a6c6716ffe91a10faba4592 /crates/fparkan-runtime/src | |
| parent | 364f8a0984e5cd3b65e81f24e95fcf8cd92aec2d (diff) | |
| download | fparkan-31dd73cbf59f5c8fe58b77b373a75033dc5a037a.tar.xz fparkan-31dd73cbf59f5c8fe58b77b373a75033dc5a037a.zip | |
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.
Diffstat (limited to 'crates/fparkan-runtime/src')
| -rw-r--r-- | crates/fparkan-runtime/src/control_profile.rs | 2 | ||||
| -rw-r--r-- | crates/fparkan-runtime/src/control_resources.rs | 6 | ||||
| -rw-r--r-- | crates/fparkan-runtime/src/lib.rs | 12 |
3 files changed, 19 insertions, 1 deletions
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<f32>, - 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, |
