From 3a4ac6f3f797344f9441ecf8ae84b0c96a28b319 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 3 Dec 2026 11:46:30 +0400 Subject: fix(ui): show live factory builds on cockpit instruments --- crates/fparkan-runtime/src/cockpit_instruments.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'crates/fparkan-runtime') diff --git a/crates/fparkan-runtime/src/cockpit_instruments.rs b/crates/fparkan-runtime/src/cockpit_instruments.rs index 4948773e..202de3c7 100644 --- a/crates/fparkan-runtime/src/cockpit_instruments.rs +++ b/crates/fparkan-runtime/src/cockpit_instruments.rs @@ -9,8 +9,9 @@ use crate::{ strategic_map_readout::{contact_readout, ContactReadout}, weapon_pose::WeaponPoses, Engine, MissionControlDeviceTableStatus, MissionControlNodeProviderTableStatus, - StartingCockpit, HERO_UNIT_CLASS, + MissionObjectDraft, StartingCockpit, HERO_UNIT_CLASS, }; +use fparkan_assets::MissionAssets; use fparkan_world::{identity_metadata, transform_state, ObjectHandle}; /// Data shared by the controlled object and the selected target instruments. @@ -96,8 +97,17 @@ pub fn instrument_readout( pub fn instrument_bounds(engine: &Engine, object_index: usize) -> Option<([f32; 3], f32)> { let mission = engine.loaded.as_ref()?; let draft = mission.object_drafts.get(object_index)?; - let poses = WeaponPoses::new(draft, &mission.mission_assets, object_index); - enclosing_sphere(&poses.instrument_node_spheres(&mission.mission_assets, object_index)) + instrument_asset_bounds(&mission.mission_assets, draft, object_index) +} + +/// Computes the same sphere for a project being prepared for the scene. +pub fn instrument_asset_bounds( + assets: &MissionAssets, + draft: &MissionObjectDraft, + asset_row: usize, +) -> Option<([f32; 3], f32)> { + let poses = WeaponPoses::new(draft, assets, asset_row); + enclosing_sphere(&poses.instrument_node_spheres(assets, asset_row)) } /// Current MSH state by component and local node. A detached warbot part has -- cgit v1.2.3