diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-25 19:14:25 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-25 19:14:25 +0300 |
| commit | 5cc5602b3fa42e5864d205a1c42c895504038b10 (patch) | |
| tree | e6a664fcfd8b4f69b0d0958da661e2e059d53d92 /crates/fparkan-runtime/src/mission_events.rs | |
| parent | 85474bcd60f66b610985c90a697351837208528b (diff) | |
| download | fparkan-5cc5602b3fa42e5864d205a1c42c895504038b10.tar.xz fparkan-5cc5602b3fa42e5864d205a1c42c895504038b10.zip | |
fix(ai): start player and clan cycles on the first update
Fresh AI contexts enter their first cycle immediately, including the player
context with an empty Problems0. Share their logical clock with Mission
timeouts and registration notifications. The stock original confirms the
first Mission callback sees zero before the first AI cycle.
Run the player Problems0 path and support TAKE_ALL_BATTLE_UNITS: preserve
reserved and same-kind assignments, take warbots from other combat tasks.
Native ai.dll calls verify recruitment and the initial shared RNG draws.
Validation: workspace fmt/check/tests, release build, licensed stock-clock
test, all 29 stock missions at --sim-report 900 without script stops, and
stock mission windows 28 and 20. Full AI chronology, native occupancy and
remaining RNG consumers are still approximate.
Diffstat (limited to 'crates/fparkan-runtime/src/mission_events.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/mission_events.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/fparkan-runtime/src/mission_events.rs b/crates/fparkan-runtime/src/mission_events.rs index db37851f..e8da353c 100644 --- a/crates/fparkan-runtime/src/mission_events.rs +++ b/crates/fparkan-runtime/src/mission_events.rs @@ -779,7 +779,7 @@ impl LoadedMissionState { let inside_exit = exit_event.is_some() && self.hero_in_teleport_exit(world); let entered_exit = inside_exit && !self.mission_events.inside_hero_exit; self.mission_events.inside_hero_exit = inside_exit; - // shortcut: use the caller's queue clock until the AI wall clock is wired. + // shortcut: dispatch Mission on the shared 2 s queue timer until its native cadence is wired. let (event_index, event) = if entered_exit && self.script_outcome == super::MissionScriptOutcome::Active { exit_event? @@ -796,7 +796,7 @@ impl LoadedMissionState { .iter_mut() .find(|state| state.clan_index == bundle.clan_index)?; let mission_events = &mut self.mission_events; - let clock_seconds = crate::script_time::elapsed_seconds(mission_events.start_ms, now_ms); + let clock_seconds = self.clan_ai_events.clock_seconds(bundle.clan_index); let mut notices = Vec::new(); let mut patrol_orders = Vec::new(); let execution = declarations.execute_mission_prefix( |
