From 5f0b8c076b40f8eca67e2745367c731f803914f4 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 2 Dec 2026 11:09:58 +0400 Subject: feat(ui): select units from the strategic warbot roster --- crates/fparkan-runtime/src/unit_patrol/orders.rs | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'crates/fparkan-runtime/src/unit_patrol') diff --git a/crates/fparkan-runtime/src/unit_patrol/orders.rs b/crates/fparkan-runtime/src/unit_patrol/orders.rs index 560f2142..8e9260a1 100644 --- a/crates/fparkan-runtime/src/unit_patrol/orders.rs +++ b/crates/fparkan-runtime/src/unit_patrol/orders.rs @@ -50,6 +50,33 @@ pub(crate) fn supports_order(order: &Handler15Invocation) -> bool { } impl UnitPatrol { + pub(crate) fn active_order_code(&self, actor: ObjectHandle) -> u32 { + if self.is_leaving_factory(actor) { + return 0x14; + } + if self.is_shut_down(actor) { + return UnitOrder::Shutdown.opcode(); + } + let Some(unit) = self.units.iter().find(|unit| unit.handle == actor) else { + return 0; + }; + if unit.capture_target.is_some() { + 0x11 + } else if unit.attack_target.is_some() || unit.raid_factory.is_some() { + 3 + } else if unit + .destinations + .as_ref() + .is_some_and(|points| !points.is_empty()) + { + 2 + } else if unit.destinations.is_none() { + 4 + } else { + 0 + } + } + pub(crate) fn satellite_route(&self, actor: ObjectHandle) -> Vec<[f32; 2]> { let active = self.units.iter().find(|unit| unit.handle == actor); // iron3d+0x77ae0 prefers the path whenever there are unvisited points. -- cgit v1.2.3