aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/lib.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-25 21:16:35 +0300
committerValentin Popov <valentin@popov.link>2026-11-25 21:16:35 +0300
commit574a1c02ba88b5205437cca3c0b0c29fe1afa945 (patch)
treef46bd7dacc2bcee46e98716c28159e530e515fae /crates/fparkan-runtime/src/lib.rs
parent547a4b1386ae022ba3c5f918f0903410cfc3040e (diff)
downloadfparkan-574a1c02ba88b5205437cca3c0b0c29fe1afa945.tar.xz
fparkan-574a1c02ba88b5205437cca3c0b0c29fe1afa945.zip
fix(production): pace factory tasks with the Behavior timer
Factory orders used to advance on every render/headless step, although the ore request contains a per-call increment. Gate active free and paid orders with the shared Behavior 1/1 task clock, without catch-up updates. Report admitted steps per clan and factory; idle owner phase and full RNG ordering remain explicit approximations. Live GOG Behavior.dll calls at RVA 0x2a4f0 pass through 0x34a30 and 0x54a0 with timer words 1/1. A licensed regression verifies the strict deadline and resource pull; paid production and scripted warbot, transport and builder regressions pass. Workspace fmt/check/tests and release build pass. Stock 29-mission simulation and a stock mission-28 window check cover integration.
Diffstat (limited to 'crates/fparkan-runtime/src/lib.rs')
-rw-r--r--crates/fparkan-runtime/src/lib.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs
index 78f72ce9..ac635ad2 100644
--- a/crates/fparkan-runtime/src/lib.rs
+++ b/crates/fparkan-runtime/src/lib.rs
@@ -2805,7 +2805,12 @@ pub fn step_headless(
}
let (produced_unit, production_failure) =
if let (Some(production), Some(mission)) = (&mut engine.production, &mut engine.loaded) {
- match production.tick(&mut engine.world, mission, queue_time_ms) {
+ match production.tick(
+ &mut engine.world,
+ mission,
+ queue_time_ms,
+ &mut engine.behavior_rng_state,
+ ) {
Ok(unit) => (unit, None),
Err(error) => (None, Some(error.to_string())),
}
@@ -2934,6 +2939,8 @@ pub struct SimulationReport {
pub script_factory_rejections: Vec<(u16, u32, u64)>,
/// Accepted approximate script construction orders by clan and factory slot.
pub script_factory_orders: Vec<(u16, u32, u64)>,
+ /// Active factory task updates; idle owner phases and global RNG order remain approximate.
+ pub factory_clock_ticks: Vec<(u16, u32, u64)>,
/// Approximate clan strength queries, grouped by caller and target clan.
pub script_strength_queries: Vec<(usize, u16, u64)>,
pub script_capture_queries: Vec<(usize, u64)>,
@@ -3007,6 +3014,7 @@ pub fn simulate_mission_report(
clan_problem_starts: Vec::new(),
script_factory_rejections: Vec::new(),
script_factory_orders: Vec::new(),
+ factory_clock_ticks: Vec::new(),
script_strength_queries: Vec::new(),
script_capture_queries: Vec::new(),
script_attack_queries: Vec::new(),
@@ -3114,6 +3122,9 @@ pub fn simulate_mission_report(
.clan_research_catalogs
.extend(loaded.clan_ai_events.research_catalogs());
report.laboratory = loaded.laboratories.report();
+ if let Some(production) = &engine.production {
+ report.factory_clock_ticks.extend(production.clock_ticks());
+ }
for problem in loaded.clan_ai_events.pending_problems() {
*report
.clan_problem_dispatch_stubs