From 4c9f4945eda0c818154a39361ff21aa787743030 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 14 Nov 2026 11:43:03 +0400 Subject: feat(runtime): count exact clan classes in mission scripts --- crates/fparkan-runtime/src/lib.rs | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (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 c98554a2..e335c62a 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -17713,6 +17713,53 @@ mod tests { assert_eq!(idle.player_pitch_bits, blocked.player_pitch_bits); } + #[test] + #[ignore = "requires licensed corpus"] + fn licensed_field_camp_script_counts_player_mines() { + let vfs: Arc = Arc::new(DirectoryVfs::new(licensed_root("IS"))); + let mut engine = create(EngineServices::new(vfs)).unwrap(); + load_mission_with_init_stubs( + &mut engine, + MissionRequest { + key: "MISSIONS/CAMPAIGN/CAMPAIGN.00/Mission.03/data.tma".into(), + mode: MissionMode::SingleMission, + }, + MissionStartupInput { + queue_time_ms: 0, + research_creation_gate: false, + }, + ) + .unwrap(); + let before = frame(&mut engine, 1).unwrap().mission_event.unwrap(); + assert!( + before + .stop + .as_ref() + .is_none_or(|stop| stop.instruction_index > 91), + "{:?}", + before.stop + ); + assert!(!before + .notices + .contains(&MissionNotice::ObjectiveComplete(2))); + // The tutorial starts before a mine has been deployed. + let mine = construct_object(&mut engine.world, ObjectDraft { original_id: None }).unwrap(); + fparkan_world::set_owner(&mut engine.world, mine, Some(fparkan_world::OwnerId(0))).unwrap(); + register_object(&mut engine.world, mine).unwrap(); + engine + .loaded + .as_mut() + .unwrap() + .mission_events + .register_unit(&engine.world, mine, 0x8000_0004); + let after = frame(&mut engine, 2001).unwrap().mission_event.unwrap(); + assert!(after.stop.is_none(), "{:?}", after.stop); + assert!( + after.notices.contains(&MissionNotice::ObjectiveComplete(2)), + "{after:?}" + ); + } + #[test] #[ignore = "requires licensed corpus"] fn licensed_constructor_captures_factory_and_hangar_at_communicators() { -- cgit v1.2.3