diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-25 13:21:31 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-25 13:21:31 +0300 |
| commit | 7962aa90e3a3b70d6ed5bd5c6a4ad991b3bc0199 (patch) | |
| tree | 4d8e2c37409cb25f654a1db8b956ca6c83fc2260 /crates/fparkan-runtime/src/lib.rs | |
| parent | 2656cca01b65745e9e6aa7b11d80414039e4cc67 (diff) | |
| download | fparkan-7962aa90e3a3b70d6ed5bd5c6a4ad991b3bc0199.tar.xz fparkan-7962aa90e3a3b70d6ed5bd5c6a4ad991b3bc0199.zip | |
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.
Diffstat (limited to 'crates/fparkan-runtime/src/lib.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/lib.rs | 11 |
1 files changed, 10 insertions, 1 deletions
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<MissionEventTick>, + /// Notifications emitted by clan AI scripts on this step. + pub clan_notices: Vec<MissionNotice>, /// 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); |
