aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-03 10:46:30 +0300
committerValentin Popov <valentin@popov.link>2026-12-03 10:46:30 +0300
commit3a4ac6f3f797344f9441ecf8ae84b0c96a28b319 (patch)
treed24557bdc9fa48bbed3bf50bd824723313cfe58c /crates/fparkan-runtime
parentf4286bc592d629288f5fa7a58277a84474af6154 (diff)
downloadfparkan-3a4ac6f3f797344f9441ecf8ae84b0c96a28b319.tar.xz
fparkan-3a4ac6f3f797344f9441ecf8ae84b0c96a28b319.zip
fix(ui): show live factory builds on cockpit instruments
Diffstat (limited to 'crates/fparkan-runtime')
-rw-r--r--crates/fparkan-runtime/src/cockpit_instruments.rs16
1 files changed, 13 insertions, 3 deletions
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