From 777f48345c7faf891ac105fc4a831114914aff5d Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Tue, 1 Dec 2026 08:33:51 +0400 Subject: fix(combat): charge the drive before refilling weapons Read the resource multiplier from CTL when all authored states agree and price the latest local motion in the existing Control budget. A licensed AutoDemo flyer charges its weapons more slowly when the drive is drawing from the same supply. Control.dll oracle vectors, the AutoDemo window, and all 29 mission startup sweeps pass. --- crates/fparkan-runtime/src/lib.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'crates/fparkan-runtime/src/lib.rs') diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs index 5f3f436e..0ac5197f 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -4495,11 +4495,19 @@ fn control_node_provider_row_from_status( fn control_resource_budget_pass( table: &mut MissionControlDeviceTableState, delta_time_seconds: f32, +) -> Result<(), ControlResourceAccessError> { + control_resource_budget_pass_with_motion(table, delta_time_seconds, None) +} + +fn control_resource_budget_pass_with_motion( + table: &mut MissionControlDeviceTableState, + delta_time_seconds: f32, + motion: Option, ) -> Result<(), ControlResourceAccessError> { let delta_time_seconds = checked_control_float(0, "Control resource interval", delta_time_seconds)?; let mut updated = table.clone(); - control_resource_budget_pass_inner(&mut updated, delta_time_seconds)?; + control_resource_budget_pass_inner(&mut updated, delta_time_seconds, motion)?; *table = updated; Ok(()) } @@ -4507,6 +4515,7 @@ fn control_resource_budget_pass( fn control_resource_budget_pass_inner( table: &mut MissionControlDeviceTableState, delta_time_seconds: f32, + motion: Option, ) -> Result<(), ControlResourceAccessError> { let device_count = match &table.status { MissionControlDeviceTableStatus::Available(devices) => devices.len(), @@ -4534,7 +4543,12 @@ fn control_resource_budget_pass_inner( let mut positive_rate_sum = 0.0_f32; for index in 0..device_count { let device = control_budget_device(table, index)?; - let rate = control_device_resource_rate(table, &device, delta_time_seconds)?; + let rate = match motion { + Some(motion) if device.factory_tag == 5 => { + motion.rate(table, device, delta_time_seconds)? + } + _ => control_device_resource_rate(table, device, delta_time_seconds)?, + }; if rate > 0.0 { positive_rate_sum = checked_control_sum( device.factory_tag, @@ -8381,6 +8395,7 @@ mod tests { PreparedComponentControl { source: synthetic_resource_key(940), native_profile_words: [0; 27], + uniform_drive_factor_bits: None, model_node_count: 3, bindings: Vec::new(), timeline_rows: Vec::new(), @@ -8888,6 +8903,7 @@ mod tests { PreparedComponentControl { source: synthetic_resource_key(100 + index), native_profile_words: [0; 27], + uniform_drive_factor_bits: None, model_node_count: 0, bindings: Vec::new(), timeline_rows: Vec::new(), -- cgit v1.2.3