From 20161fbf4fab9080a2d0d6ceedbf1344435cfda0 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 2 Dec 2026 11:40:01 +0400 Subject: feat(ui): show live Control stats in the warbot card --- crates/fparkan-runtime/src/strategic_roster.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/fparkan-runtime/src/strategic_roster.rs') diff --git a/crates/fparkan-runtime/src/strategic_roster.rs b/crates/fparkan-runtime/src/strategic_roster.rs index acf22590..df615e0a 100644 --- a/crates/fparkan-runtime/src/strategic_roster.rs +++ b/crates/fparkan-runtime/src/strategic_roster.rs @@ -71,6 +71,8 @@ pub struct WarbotRow { pub chassis: u32, /// Whether the unit is eligible for automatic selection. pub selectable: bool, + /// Remaining provider capacity of all nodes, rounded as in the original list. + pub durability_percent: Option, } /// Returns the player's warbots in registration order, including any entries whose controller is depleted. @@ -122,6 +124,7 @@ pub fn warbot_rows(engine: &Engine, cockpit: StartingCockpit) -> Vec size, chassis, selectable: !table.node_provider_depletion_marked, + durability_percent: crate::warbot_stats::durability_percent(table), }; Some((sequence, row)) }) @@ -209,6 +212,15 @@ mod tests { ] ); + let heavy = crate::warbot_stats::warbot_stats(&engine, rows[1].handle).unwrap(); + assert_eq!(rows[1].durability_percent, Some(100)); + assert_eq!(heavy.radar, Some(400.0)); + assert_eq!(heavy.offence.unwrap().to_bits(), 0x4556_9556); + assert!( + (heavy.defence.unwrap() - 14_329.729).abs() < 0.5, + "{heavy:?}" + ); + set_owner(&mut engine.world, rows[0].handle, None).unwrap(); assert_eq!(warbot_rows(&engine, cockpit), rows[1..]); } -- cgit v1.2.3