aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/unit_patrol.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-14 22:04:26 +0300
committerValentin Popov <valentin@popov.link>2026-11-14 22:04:26 +0300
commite1f26ba007532eca4b6afe4d49aca58799c1ce05 (patch)
tree49b8bf2631ea79cb48bf7c0d8324570f893acf9f /crates/fparkan-runtime/src/unit_patrol.rs
parenta25aa2959dbac4d0f2a91299de16e12f492699f3 (diff)
downloadfparkan-e1f26ba007532eca4b6afe4d49aca58799c1ce05.tar.xz
fparkan-e1f26ba007532eca4b6afe4d49aca58799c1ce05.zip
feat(ai): dispatch scripted warbot groups
Single.01 selects a free warbot for the capture problem and issues a patrol around the moving capturer from stock startup. Group recruitment uses the supported TAKE_BY_HITS branch. Priority preemption and group expression scheduling remain open.
Diffstat (limited to 'crates/fparkan-runtime/src/unit_patrol.rs')
-rw-r--r--crates/fparkan-runtime/src/unit_patrol.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/unit_patrol.rs b/crates/fparkan-runtime/src/unit_patrol.rs
index c4b3b969..bc2dc3a4 100644
--- a/crates/fparkan-runtime/src/unit_patrol.rs
+++ b/crates/fparkan-runtime/src/unit_patrol.rs
@@ -242,6 +242,17 @@ impl UnitPatrol {
self.units.iter().any(|unit| unit.handle == handle)
}
+ pub(super) fn has_object_order(&self, handle: ObjectHandle, target: ObjectHandle) -> bool {
+ self.units
+ .iter()
+ .any(|unit| unit.handle == handle && unit.center_object == Some(target))
+ }
+
+ pub(super) fn clear_object_order(&mut self, handle: ObjectHandle, target: ObjectHandle) {
+ self.units
+ .retain(|unit| unit.handle != handle || unit.center_object != Some(target));
+ }
+
pub(super) fn shut_down(&mut self, handle: ObjectHandle) -> bool {
// shortcut: stop autonomous movement and fire until the native shutdown task is modeled.
self.units.retain(|unit| unit.handle != handle);