aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/clan_script_init.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-14 19:44:49 +0300
committerValentin Popov <valentin@popov.link>2026-11-14 19:44:49 +0300
commit0e8d4df52cb11185cc9962f5cab0077246605a8b (patch)
treefdd3ee648fded57a0c06340c27bfbcb7467bb2d7 /crates/fparkan-runtime/src/clan_script_init.rs
parent2420e84d82cc1afdafc70882e51d4482dcdaad5b (diff)
downloadfparkan-0e8d4df52cb11185cc9962f5cab0077246605a8b.tar.xz
fparkan-0e8d4df52cb11185cc9962f5cab0077246605a8b.zip
fix(script): continue Init past the uncovered AI setting
Handler(69) writes an AI field for nonnegative DWORD operands. Until its consumer is modeled, the observed form is counted as a stub. Mission 10 now runs the subsequent shutdown and patrol orders and finishes clan Init.
Diffstat (limited to 'crates/fparkan-runtime/src/clan_script_init.rs')
-rw-r--r--crates/fparkan-runtime/src/clan_script_init.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/clan_script_init.rs b/crates/fparkan-runtime/src/clan_script_init.rs
index a827df14..891cc5a3 100644
--- a/crates/fparkan-runtime/src/clan_script_init.rs
+++ b/crates/fparkan-runtime/src/clan_script_init.rs
@@ -66,6 +66,12 @@ pub(super) fn stubbed_handler(
{
Some(68)
}
+ // shortcut: resume Init until the AI consumer of this setting is wired.
+ ([69, u32::MAX, u32::MAX, u32::MAX, 6, 1, u32::MAX], [index])
+ if matches!(values.get(*index as usize), Some(VarSetDefault::Dword(_))) =>
+ {
+ Some(69)
+ }
_ => None,
}
}
@@ -102,6 +108,22 @@ mod tests {
}
#[test]
+ fn ai_setting_stub_requires_a_dword_operand_and_no_result() {
+ let mut instruction = ScriptInstruction {
+ header_words: [69, u32::MAX, u32::MAX, u32::MAX, 6, 1, u32::MAX],
+ references: vec![0],
+ };
+ let values = [VarSetDefault::Dword(15)];
+ assert_eq!(stubbed_handler(&instruction, &values), Some(69));
+ assert_eq!(
+ stubbed_handler(&instruction, &[VarSetDefault::FloatBits(0)]),
+ None
+ );
+ instruction.header_words[1] = 0;
+ assert_eq!(stubbed_handler(&instruction, &values), None);
+ }
+
+ #[test]
fn reservation_reads_logical_id_and_treats_every_nonzero_flag_as_set() {
let instruction = ScriptInstruction {
header_words: [51, u32::MAX, u32::MAX, u32::MAX, 6, 2, u32::MAX],