aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/lib.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-14 20:30:46 +0300
committerValentin Popov <valentin@popov.link>2026-11-14 20:30:46 +0300
commitc930b4e3a4a693ebcee2e46005c32d42567449d7 (patch)
tree467c22371d8c405bba3c12e189ddd6649b7854bb /crates/fparkan-runtime/src/lib.rs
parent5a9bf002bc7e0da46f7f60cb3b248fe70176596a (diff)
downloadfparkan-c930b4e3a4a693ebcee2e46005c32d42567449d7.tar.xz
fparkan-c930b4e3a4a693ebcee2e46005c32d42567449d7.zip
feat(ai): queue clan script problems by native identity
Pass Handler(2) operands through the existing scheduler and require matching script sections. The stock Two Fortresses clan queues research, transport, and robot problems before its combat-strength query. Pending dispatch is counted by clan and problem kind.
Diffstat (limited to 'crates/fparkan-runtime/src/lib.rs')
-rw-r--r--crates/fparkan-runtime/src/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs
index 7b1eefa1..6fb2b320 100644
--- a/crates/fparkan-runtime/src/lib.rs
+++ b/crates/fparkan-runtime/src/lib.rs
@@ -2902,6 +2902,8 @@ pub struct SimulationReport {
pub clan_ai_event_stops: Vec<(MissionEventStop, u64)>,
/// Calls to stubbed research policy or status, grouped by clan and handler.
pub clan_research_status_stubs: Vec<(usize, u8, u64)>,
+ /// Counts of pending script problems by clan and problem kind.
+ pub clan_problem_dispatch_stubs: std::collections::BTreeMap<(usize, u32), u64>,
/// Total requests for mission information messages.
pub mission_messages: u64,
/// Clock of the first autonomous shot, in milliseconds.
@@ -2937,6 +2939,7 @@ pub fn simulate_mission_report(
mission_event_stops: Vec::new(),
clan_ai_event_stops: Vec::new(),
clan_research_status_stubs: Vec::new(),
+ clan_problem_dispatch_stubs: Default::default(),
mission_messages: 0,
autodemo_first_shot_ms: None,
autodemo_first_destroyed_ms: None,
@@ -2991,6 +2994,12 @@ pub fn simulate_mission_report(
report
.clan_research_status_stubs
.extend(loaded.clan_ai_events.research_status_stubs());
+ for problem in loaded.clan_ai_events.pending_problems() {
+ *report
+ .clan_problem_dispatch_stubs
+ .entry(problem)
+ .or_default() += 1;
+ }
}
Ok(report)
}