From 7962aa90e3a3b70d6ed5bd5c6a4ad991b3bc0199 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 25 Nov 2026 14:21:31 +0400 Subject: feat(ai): deliver clan script notifications to the player Handle clan Handler(30) through the same host command and first-message state as the Mission event. Carry clan notices in FrameResult and pass them to the existing text and voice queues without changing the Mission tick counter. Extract shared host dispatch and app presentation modules. Execute ai.dll RVA 0xc266 with the original hash guard: clan contexts 0 and 2 call the global host as (0, MESSAGE_INFO, index), reading live varset cells. Extend the licensed stock Convoy test to require message 0 after the delayed attack, and test shared first-message and AutoDemo behavior. Repeated native message UI branches remain explicit debt. Validate fmt, workspace check/tests, licensed stock-start test, release simulation and the mission window. Clock replay checks message delivery, not full mission completion. --- crates/fparkan-runtime/src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (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 0b250ad5..0d1ea501 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -65,6 +65,7 @@ mod player_weapon; mod production; mod projectile; mod research; +mod script_host; mod script_patrol; mod script_time; mod unit_combat; @@ -1317,6 +1318,8 @@ pub struct FrameResult { pub snapshot: WorldSnapshot, /// Periodic script event attempted on this step, if due. pub mission_event: Option, + /// Notifications emitted by clan AI scripts on this step. + pub clan_notices: Vec, /// Vertical aim of the controlled hero as an IEEE-754 radian value. pub player_pitch_bits: u32, /// Autonomous combat events during the step. @@ -2865,7 +2868,7 @@ pub fn step_headless( .loaded .as_mut() .and_then(|state| state.tick_mission_event(&engine.world, queue_time_ms)); - clan_ai_events::tick(engine, queue_time_ms); + let clan_notices = clan_ai_events::tick(engine, queue_time_ms); let researched_component = engine .loaded .as_mut() @@ -2873,6 +2876,7 @@ pub fn step_headless( Ok(FrameResult { snapshot, mission_event, + clan_notices, autodemo_combat_events, autodemo_combat_unavailable, autodemo_reinforcements, @@ -3088,6 +3092,11 @@ pub fn simulate_mission_report( AutoDemoCombatEvent::BuildingHit { .. } => continue, }; } + report.mission_messages += frame + .clan_notices + .iter() + .filter(|notice| matches!(notice, MissionNotice::Information(_))) + .count() as u64; if let Some(event) = frame.mission_event { report.mission_events += 1; report.mission_event_stops.extend(event.stop); -- cgit v1.2.3