aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/unit_combat.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 12:07:11 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 12:07:11 +0300
commit7dd027fd5130daf532cd2214a6d9689293bb2c86 (patch)
tree16750c5f0652031a839d3e1563da73719a9c7afe /crates/fparkan-runtime/src/unit_combat.rs
parentdc92ae05f97d84a1681995e0712b01053e48704c (diff)
downloadfparkan-7dd027fd5130daf532cd2214a6d9689293bb2c86.tar.xz
fparkan-7dd027fd5130daf532cd2214a6d9689293bb2c86.zip
feat(ui): assign search and destroy from the warbot panel
Show the native search status immediately without opening the map. Verify from the stock Two Fortresses start that the selected marker moves with the internal route hidden and that Stand cancels the search.
Diffstat (limited to 'crates/fparkan-runtime/src/unit_combat.rs')
-rw-r--r--crates/fparkan-runtime/src/unit_combat.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/unit_combat.rs b/crates/fparkan-runtime/src/unit_combat.rs
index f46b46bf..59c9ec64 100644
--- a/crates/fparkan-runtime/src/unit_combat.rs
+++ b/crates/fparkan-runtime/src/unit_combat.rs
@@ -460,6 +460,9 @@ impl AutoDemoCombat {
return None;
}
let idle_clock = fire_clock_ms.filter(|_| unit.uses_default_targeting(patrol));
+ let search = patrol
+ .filter(|_| !use_weapon_range)
+ .and_then(|patrol| patrol.search_target(handle));
let search_distance = if use_weapon_range && idle_clock.is_none() {
self.maximum_firing_distance(unit)
} else {
@@ -470,6 +473,7 @@ impl AutoDemoCombat {
.filter_map(|&(enemy, other, to, radius, target_position)| {
let enemy = enemy.handle;
if enemy == handle
+ || search.is_some_and(|target| target != Some(enemy))
|| limit
.is_some_and(|limit| !limit.allows_target(enemy, target_position))
|| self.hostile.get(clan)?.get(other) != Some(&true)