aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/robot_designer.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 07:00:08 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 07:00:08 +0300
commitdcba82d1cdf4a70ab879d8af0a623a10deecb544 (patch)
tree990640d51dc917b59baf0c02a7d7bdba12557cef /apps/fparkan-game/src/robot_designer.rs
parent5be1b800d028ba30c5e2a4ff84983c700b4e9175 (diff)
downloadfparkan-dcba82d1cdf4a70ab879d8af0a623a10deecb544.tar.xz
fparkan-dcba82d1cdf4a70ab879d8af0a623a10deecb544.zip
feat(factory): build newly loaded projects without restarting the mission
Transfer a saved design from the original designer panel, prepare it with the regular AniMesh scene builder, and queue the selected factory order. Appended world batches keep existing draw handles and gain the normal cockpit, walking animation, weapon and shield bindings. The Field Camp window witness adds a one-gun Unit DAT after mission start, uses the normal transfer and order controls, supplies the factory with a scripted test fixture, and captures the released unit with Vulkan validation clean. The two licensed factory tests also verify the assembled component records and weapon control.
Diffstat (limited to 'apps/fparkan-game/src/robot_designer.rs')
-rw-r--r--apps/fparkan-game/src/robot_designer.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/apps/fparkan-game/src/robot_designer.rs b/apps/fparkan-game/src/robot_designer.rs
index 26436d94..2d1be0d0 100644
--- a/apps/fparkan-game/src/robot_designer.rs
+++ b/apps/fparkan-game/src/robot_designer.rs
@@ -10,6 +10,7 @@ use fparkan_assets::designer_screen::{
use fparkan_platform_winit::text::StringResources;
use fparkan_runtime::{factory_design_parts, factory_project_components, Engine};
use std::{
+ collections::HashMap,
path::Path,
sync::{Arc, Weak},
};
@@ -18,6 +19,7 @@ pub(super) struct RobotDesignerPanel {
assets: DesignerScreen,
background: EnvironmentGpuRange,
models: DesignerModels,
+ live_models: HashMap<usize, Arc<PreparedProjectModel>>,
uploaded: Option<(Weak<PreparedProjectModel>, DesignerModel)>,
range: EnvironmentGpuRange,
}
@@ -56,6 +58,7 @@ impl RobotDesignerPanel {
assets,
background,
models,
+ live_models: HashMap::new(),
uploaded: None,
range,
})
@@ -67,6 +70,15 @@ impl RobotDesignerPanel {
.chain(self.models.ranges())
}
+ pub(super) fn remember_live_model(
+ &mut self,
+ scheme: usize,
+ project: Arc<PreparedProjectModel>,
+ ) {
+ self.live_models.entry(scheme).or_insert(project);
+ self.uploaded = None;
+ }
+
pub(super) fn draw(
&mut self,
renderer: &mut VulkanSmokeRenderer,
@@ -87,7 +99,10 @@ impl RobotDesignerPanel {
if let Some((project, elapsed)) = menu.as_ref().and_then(|menu| {
let designer = menu.designer.as_ref()?;
Some((
- designer.preview_project.as_ref()?,
+ designer.preview_project.as_ref().or_else(|| {
+ self.live_models
+ .get(&designer.active_scheme(&menu.choices)?)
+ })?,
clock_ms.saturating_sub(designer.model_started_ms),
))
}) {
@@ -171,7 +186,7 @@ impl RobotDesignerPanel {
hover: designer.hover,
file_dialog,
file_status: designer.file_status.as_deref(),
- buildable: buildable.is_some(),
+ buildable: buildable.is_some() || designer.preview_project.is_some(),
})?;
renderer
.update_material_texture(