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/clan_ai_events.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'crates/fparkan-runtime/src/clan_ai_events.rs') diff --git a/crates/fparkan-runtime/src/clan_ai_events.rs b/crates/fparkan-runtime/src/clan_ai_events.rs index 5af3c086..573318cf 100644 --- a/crates/fparkan-runtime/src/clan_ai_events.rs +++ b/crates/fparkan-runtime/src/clan_ai_events.rs @@ -4,7 +4,7 @@ use crate::{ clan_combat_groups::{CombatGroup, GroupTarget}, clan_targeting::CaptureApproach, }; -use crate::{BehaviorOreState, LoadedMissionState, MissionEventStop}; +use crate::{BehaviorOreState, LoadedMissionState, MissionEventStop, MissionNotice}; use fparkan_script::{ Handler15TargetPayload, Handler2Record, Handler2RecordInput, Handler2RecordKey, Handler2RecordScheduler, ScriptDispatchSelector, VarSet, VarSetDefault, @@ -83,9 +83,10 @@ pub(super) fn resolve_captures( Ok(captured) } -pub(super) fn tick(engine: &mut crate::Engine, now_ms: u32) { +pub(super) fn tick(engine: &mut crate::Engine, now_ms: u32) -> Vec { + let mut notices = Vec::new(); let Some(loaded) = &mut engine.loaded else { - return; + return notices; }; crate::construction::tick(loaded, &mut engine.world, now_ms); loaded.clan_ai_events.groups.retain(|&(clan, _), group| { @@ -166,6 +167,7 @@ pub(super) fn tick(engine: &mut crate::Engine, now_ms: u32) { engine.production.as_ref(), engine.services.vfs.as_deref(), now_ms, + &mut notices, ) { match crate::production::order_script_factory( engine, @@ -213,6 +215,7 @@ pub(super) fn tick(engine: &mut crate::Engine, now_ms: u32) { } } } + notices } #[derive(Default)] @@ -264,6 +267,7 @@ impl LoadedMissionState { production: Option<&crate::production::Production>, vfs: Option<&dyn fparkan_vfs::Vfs>, now_ms: u32, + notices: &mut Vec, ) -> Vec { let mut orders = Vec::new(); let Some(varset) = &self.script_varset else { @@ -420,6 +424,16 @@ impl LoadedMissionState { .scalar_1; Ok(Some(VarSetDefault::FloatBits(priority.to_bits()))) } + ScriptDispatchSelector::Handler(30) => { + let command = varset.declarations + .resolve_handler30_with_values(instruction, values) + .map_err(|error| error.to_string())?; + crate::script_host::apply( + self.script_host_mode, &mut self.script_host_status, + &mut self.script_outcome, &mut self.mission_events, command, notices, + )?; + Ok(None) + } ScriptDispatchSelector::Handler(71) => { let &[radius, class, estimate] = instruction.references.as_slice() else { return Err("Handler(71) requires radius, class and strength output".into()); -- cgit v1.2.3