From 7b04b7760373ee8d86f5652b1bd2914a8ee2db79 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 14 Nov 2026 20:37:07 +0400 Subject: fix(script): continue clan Init past the base area stub Accepts the observed float form of Handler(68) through a reported gameplay stub. Mission 8 now executes its reservations and reaches the next robot order. --- crates/fparkan-runtime/src/clan_script_init.rs | 43 +++++++++++++++++++++----- crates/fparkan-runtime/src/lib.rs | 2 +- 2 files changed, 37 insertions(+), 8 deletions(-) (limited to 'crates/fparkan-runtime/src') diff --git a/crates/fparkan-runtime/src/clan_script_init.rs b/crates/fparkan-runtime/src/clan_script_init.rs index 2d5ac129..a827df14 100644 --- a/crates/fparkan-runtime/src/clan_script_init.rs +++ b/crates/fparkan-runtime/src/clan_script_init.rs @@ -50,11 +50,24 @@ pub(super) fn unit_order( ScriptPatrol::from_order(order).map(InitOrder::Patrol) } -pub(super) fn stubbed_handler(instruction: &ScriptInstruction) -> Option { - // shortcut: resume Init after the catalog refresh until the live research context is wired. - (instruction.header_words == [43, u32::MAX, u32::MAX, u32::MAX, 6, 0, u32::MAX] - && instruction.references.is_empty()) - .then_some(43) +pub(super) fn stubbed_handler( + instruction: &ScriptInstruction, + values: &[VarSetDefault], +) -> Option { + match (instruction.header_words, instruction.references.as_slice()) { + // shortcut: resume Init until the live research context is wired. + ([43, u32::MAX, u32::MAX, u32::MAX, 6, 0, u32::MAX], []) => Some(43), + // shortcut: resume Init until the native AI base-area state is wired. + ([68, u32::MAX, u32::MAX, u32::MAX, 6, 1, u32::MAX], [index]) + if matches!( + values.get(*index as usize), + Some(VarSetDefault::FloatBits(_)) + ) => + { + Some(68) + } + _ => None, + } } #[cfg(test)] @@ -67,9 +80,25 @@ mod tests { header_words: [43, u32::MAX, u32::MAX, u32::MAX, 6, 0, u32::MAX], references: Vec::new(), }; - assert_eq!(stubbed_handler(&instruction), Some(43)); + assert_eq!(stubbed_handler(&instruction, &[]), Some(43)); + instruction.header_words[1] = 0; + assert_eq!(stubbed_handler(&instruction, &[]), None); + } + + #[test] + fn base_area_stub_requires_a_float_operand_and_no_result() { + let mut instruction = ScriptInstruction { + header_words: [68, u32::MAX, u32::MAX, u32::MAX, 6, 1, u32::MAX], + references: vec![0], + }; + let values = [VarSetDefault::FloatBits(500.0_f32.to_bits())]; + assert_eq!(stubbed_handler(&instruction, &values), Some(68)); + assert_eq!( + stubbed_handler(&instruction, &[VarSetDefault::Dword(500)]), + None + ); instruction.header_words[1] = 0; - assert_eq!(stubbed_handler(&instruction), None); + assert_eq!(stubbed_handler(&instruction, &values), None); } #[test] diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs index 624560a3..a17dd6ab 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -8173,7 +8173,7 @@ fn resolve_init_states( }); return Some(None); } - if let Some(handler) = clan_script_init::stubbed_handler(instruction) { + if let Some(handler) = clan_script_init::stubbed_handler(instruction, values) { bundle.init_stubs.push((index, handler)); return Some(None); } -- cgit v1.2.3