aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-assets
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 12:27:06 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 12:27:06 +0300
commitc846377ead77ef7184cdeddd25c3f2c9d76a6736 (patch)
tree6980b05a3fa7ea41b26f64c40ad1fef91849af23 /crates/fparkan-assets
parent7dd027fd5130daf532cd2214a6d9689293bb2c86 (diff)
downloadfparkan-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-assets')
-rw-r--r--crates/fparkan-assets/src/strategic_roster.rs2
-rw-r--r--crates/fparkan-assets/src/strategic_roster/orders.rs16
2 files changed, 13 insertions, 5 deletions
diff --git a/crates/fparkan-assets/src/strategic_roster.rs b/crates/fparkan-assets/src/strategic_roster.rs
index c94281cc..1cd870a6 100644
--- a/crates/fparkan-assets/src/strategic_roster.rs
+++ b/crates/fparkan-assets/src/strategic_roster.rs
@@ -173,7 +173,7 @@ impl RosterImages {
&self,
rows: &[Row<'_>],
card: &[Option<CardLine<'_>>],
- orders: Option<([&str; 5], Option<RosterOrder>)>,
+ orders: Option<([&str; 6], Option<RosterOrder>)>,
) -> Result<RgbaImage, String> {
let mut panel = self.background.clone();
if let Some(row) = rows.iter().find(|row| row.selected) {
diff --git a/crates/fparkan-assets/src/strategic_roster/orders.rs b/crates/fparkan-assets/src/strategic_roster/orders.rs
index d4a6a9ec..75457b62 100644
--- a/crates/fparkan-assets/src/strategic_roster/orders.rs
+++ b/crates/fparkan-assets/src/strategic_roster/orders.rs
@@ -16,13 +16,16 @@ pub enum RosterOrder {
SearchAndDestroy,
/// Patrol a point or a live object.
Patrol,
+ /// Travel to a friendly facility for ammunition, charge, and repairs.
+ Recharge,
}
-const ORDERS: [RosterOrder; 4] = [
+const ORDERS: [RosterOrder; 5] = [
RosterOrder::Stand,
RosterOrder::FollowRoute,
RosterOrder::SearchAndDestroy,
RosterOrder::Patrol,
+ RosterOrder::Recharge,
];
impl RosterOrder {
@@ -32,6 +35,7 @@ impl RosterOrder {
Self::FollowRoute => 1,
Self::SearchAndDestroy => 2,
Self::Patrol => 3,
+ Self::Recharge => 4,
}
}
}
@@ -55,7 +59,7 @@ fn panel_top(count: usize) -> u32 {
pub(super) fn covers_pointer([x, y]: [f32; 2], count: usize) -> bool {
let y_top = panel_top(count);
- let y_bottom = (y_top + (RosterOrder::Patrol.slot() + 2) * ROW_PITCH).min(480);
+ let y_bottom = (y_top + (RosterOrder::Recharge.slot() + 2) * ROW_PITCH).min(480);
(LEFT as f32..RIGHT as f32).contains(&x) && (y_top as f32..y_bottom as f32).contains(&y)
}
@@ -85,7 +89,7 @@ impl OrderImages {
roster: &RosterImages,
panel: &mut RgbaImage,
count: usize,
- [title, stand, follow, search, patrol]: [&str; 5],
+ [title, stand, follow, search, patrol, recharge]: [&str; 6],
hovered: Option<RosterOrder>,
) -> Result<(), String> {
let x = LEFT - ORIGIN[0];
@@ -125,7 +129,10 @@ impl OrderImages {
[128; 3],
);
}
- for (order, label) in ORDERS.into_iter().zip([stand, follow, search, patrol]) {
+ for (order, label) in ORDERS
+ .into_iter()
+ .zip([stand, follow, search, patrol, recharge])
+ {
let y = y + (order.slot() + 1) * ROW_PITCH;
let bottom = y + ROW_HEIGHT;
let label = roster.font.centered_line(label, 247, ROW_HEIGHT as u16)?;
@@ -171,5 +178,6 @@ mod tests {
Some(RosterOrder::SearchAndDestroy)
);
assert_eq!(order_at([250.0, 258.0], 3), Some(RosterOrder::Patrol));
+ assert_eq!(order_at([250.0, 278.0], 3), Some(RosterOrder::Recharge));
}
}