aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/lib.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-25 16:04:13 +0300
committerValentin Popov <valentin@popov.link>2026-11-25 16:04:13 +0300
commita4a9b7a6478c9c1efcf0aef8b37464dc0e5b339e (patch)
tree65ed3d52be7bd52206bb6efe379ce54a3006ba0d /crates/fparkan-runtime/src/lib.rs
parente6065cd43f6c8a7091c01c04629f92248f72d865 (diff)
downloadfparkan-a4a9b7a6478c9c1efcf0aef8b37464dc0e5b339e.tar.xz
fparkan-a4a9b7a6478c9c1efcf0aef8b37464dc0e5b339e.zip
feat(ai): resupply scripted builders before construction
Use the native Building_Cost threshold to start loading from the nearest owned mine or warehouse. Transfer ore at the stock 100 units/second up to the design price, then resume the reserved building task. Mines bypass loading; direct construction can preserve native negative ore after payment. Execute Behavior.dll's config constructor, start, source selection, loading tick and resource setter in an x86 oracle. Keep exterior docking and custom Behavior configuration explicit approximations, counted per builder/source. The stock Single.02 regression now reaches another completed building after resupply without changing mission objects or resources. Validate fmt/check/ workspace tests, licensed construction and debt regressions, all 29 stock missions for 900 seconds, and mission 29 in a Vulkan-validation window.
Diffstat (limited to 'crates/fparkan-runtime/src/lib.rs')
-rw-r--r--crates/fparkan-runtime/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs
index b1e63120..10e8e2a0 100644
--- a/crates/fparkan-runtime/src/lib.rs
+++ b/crates/fparkan-runtime/src/lib.rs
@@ -43,6 +43,7 @@ use std::sync::Arc;
mod autodemo;
mod boarding;
+mod builder_supply;
mod building_door;
mod clan_ai_events;
mod clan_area_strength;
@@ -2939,6 +2940,7 @@ pub struct SimulationReport {
pub script_class_limit_queries: Vec<(usize, u32, bool, u64)>,
pub script_mine_queries: Vec<(usize, u32, u32, u32, u64)>,
pub script_construction_orders: Vec<(usize, u32, u32, u64, u64)>,
+ pub script_builder_supplies: Vec<(u16, u32, u32, u64)>,
pub script_capturer_queries: Vec<(usize, u64)>,
pub script_capture_approaches: Vec<(u32, u32, u64)>,
/// First factory completion by clan, in milliseconds.
@@ -3004,6 +3006,7 @@ pub fn simulate_mission_report(
script_class_limit_queries: Vec::new(),
script_mine_queries: Vec::new(),
script_construction_orders: Vec::new(),
+ script_builder_supplies: Vec::new(),
script_capturer_queries: Vec::new(),
script_capture_approaches: Vec::new(),
first_factory_completion_ms: Default::default(),
@@ -3155,6 +3158,13 @@ pub fn simulate_mission_report(
report
.script_construction_orders
.extend(loaded.clan_ai_events.construction_orders());
+ report.script_builder_supplies.extend(
+ loaded
+ .construction
+ .supply_orders
+ .iter()
+ .map(|(&(clan, builder, source), &count)| (clan, builder, source, count)),
+ );
report
.script_capturer_queries
.extend(loaded.clan_ai_events.capturer_queries());