From 61208d874cb3d9bf93e9f7c60aceebc287454b62 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 2 Dec 2026 11:59:08 +0400 Subject: feat(ui): give warbots standing and route orders Bind the first two commands to the live selection and shared route controller. Build the order panel from the installed compound controls and game font. In stock Two Fortresses, checked Stand, route drafting on the satellite map and terrain, and movement after confirmation with Vulkan validation. --- crates/fparkan-runtime/src/strategic_orders.rs | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 crates/fparkan-runtime/src/strategic_orders.rs (limited to 'crates/fparkan-runtime/src/strategic_orders.rs') diff --git a/crates/fparkan-runtime/src/strategic_orders.rs b/crates/fparkan-runtime/src/strategic_orders.rs new file mode 100644 index 00000000..9e364786 --- /dev/null +++ b/crates/fparkan-runtime/src/strategic_orders.rs @@ -0,0 +1,44 @@ +//! Orders issued by the player from the strategic warbot panel. + +use crate::{strategic_roster::warbot_rows, unit_patrol::UnitPatrol, Engine, StartingCockpit}; +use fparkan_world::ObjectHandle; + +/// Stops the selected warbot and clears its outstanding movement orders. +pub fn stand(engine: &mut Engine, cockpit: StartingCockpit, actor: ObjectHandle) -> bool { + issue(engine, cockpit, actor, None) +} + +/// Replaces the selected warbot's order with the confirmed sequence of world points. +pub fn follow_route( + engine: &mut Engine, + cockpit: StartingCockpit, + actor: ObjectHandle, + points: &[[f32; 2]], +) -> bool { + if points.is_empty() || !points.iter().flatten().all(|value| value.is_finite()) { + return false; + } + issue(engine, cockpit, actor, Some(points.to_vec())) +} + +fn issue( + engine: &mut Engine, + cockpit: StartingCockpit, + actor: ObjectHandle, + route: Option>, +) -> bool { + if !warbot_rows(engine, cockpit) + .iter() + .any(|row| row.handle == actor && row.selectable) + { + return false; + } + let Some(mission) = engine.loaded.as_mut() else { + return false; + }; + mission + .unit_patrol + .get_or_insert_with(UnitPatrol::scripted) + .command_order(&engine.world, actor, route); + true +} -- cgit v1.2.3