aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime
diff options
context:
space:
mode:
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