diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 12:27:06 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 12:27:06 +0300 |
| commit | c846377ead77ef7184cdeddd25c3f2c9d76a6736 (patch) | |
| tree | 6980b05a3fa7ea41b26f64c40ad1fef91849af23 /crates/fparkan-runtime/src/unit_patrol/orders.rs | |
| parent | 7dd027fd5130daf532cd2214a6d9689293bb2c86 (diff) | |
| download | fparkan-c846377ead77ef7184cdeddd25c3f2c9d76a6736.tar.xz fparkan-c846377ead77ef7184cdeddd25c3f2c9d76a6736.zip | |
feat(ui): send warbots to recharge from the strategic panel
Verify LTW-3 approaches the generator and clears its recharge status after leaving from the stock Two Fortresses start. Reuse authored building passages and shared Control replenishment, with a licensed test for refilling an empty magazine.
Diffstat (limited to 'crates/fparkan-runtime/src/unit_patrol/orders.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/unit_patrol/orders.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/crates/fparkan-runtime/src/unit_patrol/orders.rs b/crates/fparkan-runtime/src/unit_patrol/orders.rs index b956c599..8198b17d 100644 --- a/crates/fparkan-runtime/src/unit_patrol/orders.rs +++ b/crates/fparkan-runtime/src/unit_patrol/orders.rs @@ -16,6 +16,7 @@ pub(crate) enum UnitOrder { Route(Vec<[f32; 2]>), StrategicPatrol(PatrolTarget), SearchAndDestroy, + Recharge, Shutdown, Resume(Box<PatrollingUnit>), } @@ -27,6 +28,7 @@ impl UnitOrder { Self::Attack(..) => 3, Self::Patrol(..) | Self::StrategicPatrol(_) => 4, Self::SearchAndDestroy => 5, + Self::Recharge => 8, Self::Shutdown => 0x13, Self::Stand => 0x15, Self::Resume(_) => unreachable!("a suspended order has already started"), @@ -86,6 +88,8 @@ impl UnitPatrol { 0x11 } else if unit.search.is_some() { UnitOrder::SearchAndDestroy.opcode() + } else if unit.recharge.is_some() { + UnitOrder::Recharge.opcode() } else if unit.attack_target.is_some() || unit.raid_factory.is_some() { 3 } else if unit @@ -105,7 +109,9 @@ impl UnitPatrol { let active = self.units.iter().find(|unit| unit.handle == actor); // iron3d+0x77ae0 draws published waypoints. Search does not publish its // internal navigation path to the satellite map. - if let Some(unit) = active.filter(|unit| unit.search.is_none() && !unit.points.is_empty()) { + if let Some(unit) = active.filter(|unit| { + unit.search.is_none() && unit.recharge.is_none() && !unit.points.is_empty() + }) { return unit.points.iter().copied().collect(); } let mut points = Vec::new(); @@ -127,7 +133,8 @@ impl UnitPatrol { UnitOrder::Attack(..) | UnitOrder::Shutdown | UnitOrder::Stand - | UnitOrder::SearchAndDestroy => {} + | UnitOrder::SearchAndDestroy + | UnitOrder::Recharge => {} } } } @@ -308,6 +315,7 @@ impl UnitPatrol { return true; } UnitOrder::SearchAndDestroy => return self.start_search(world, actor), + UnitOrder::Recharge => return self.start_recharge(world, actor), UnitOrder::Route(route) => { for (index, &point) in route.iter().enumerate() { self.move_to(world, actor, point, index != 0); @@ -399,7 +407,7 @@ impl UnitPatrol { .iter() .find(|unit| unit.handle == actor) .is_none_or(|unit| { - if unit.capture_target.is_some() { + if unit.capture_target.is_some() || unit.recharge.is_some() { return false; } if let Some(points) = &unit.destinations { @@ -434,6 +442,9 @@ impl UnitPatrol { impl PatrollingUnit { fn append_point_orders(&self, points: &mut Vec<[f32; 2]>) { + if self.recharge.is_some() { + return; + } if let Some(destinations) = &self.destinations { points.extend(destinations); } else if self.patrols_point(self.center) && self.raid_factory.is_none() { |
