aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/production.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-14 21:03:00 +0300
committerValentin Popov <valentin@popov.link>2026-11-14 21:03:00 +0300
commit1d92ac712c970cce8cea3eacd34d4033f80c543b (patch)
treef0c0baec5e65eac5777d7f93ab934c0a3f6438ae /crates/fparkan-runtime/src/production.rs
parent846417637ee42fee7425b74d7857b5a5c751c79d (diff)
downloadfparkan-1d92ac712c970cce8cea3eacd34d4033f80c543b.tar.xz
fparkan-1d92ac712c970cce8cea3eacd34d4033f80c543b.zip
fix(ai): wait for the factory before restarting robot jobs
Track the factory assigned by ST_SOLVING and the ACTION_NOTHING_DOING expression. Stock Single.01 completes the first robot at 27 seconds without duplicate busy-factory rejections. Keep other expression variants explicitly uncovered.
Diffstat (limited to 'crates/fparkan-runtime/src/production.rs')
-rw-r--r--crates/fparkan-runtime/src/production.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/production.rs b/crates/fparkan-runtime/src/production.rs
index 315dbb5a..ab6b38e7 100644
--- a/crates/fparkan-runtime/src/production.rs
+++ b/crates/fparkan-runtime/src/production.rs
@@ -133,6 +133,12 @@ impl PaidOrder {
}
impl Production {
+ pub(super) fn is_building_at(&self, plant: ObjectHandle, owner: OwnerId) -> bool {
+ self.pending
+ .iter()
+ .any(|order| order.plant == plant && order.owner == owner)
+ }
+
pub(super) fn new(
reserve_start: usize,
schemes: Vec<NormalizedPath>,
@@ -730,6 +736,7 @@ mod tests {
"{report:?}"
);
assert!(!report.first_factory_completion_ms.contains_key(&0));
+ assert!(report.script_factory_rejections.is_empty(), "{report:?}");
let cockpit = super::super::starting_cockpit(&engine).unwrap();
let factory = handle_by_original_id(&engine.world, OriginalObjectId(5)).unwrap();
let duration = order_clan_factory_scheme(&mut engine, cockpit, factory, 0, 40_000).unwrap();