aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/lib.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 06:35:08 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 06:35:08 +0300
commit5be1b800d028ba30c5e2a4ff84983c700b4e9175 (patch)
tree111eca3acb2cbeff5dedfef3b1a55732ed3c3985 /crates/fparkan-runtime/src/lib.rs
parentb0c3a064c29c2bf97981f45806696c2dd0d4dd90 (diff)
downloadfparkan-5be1b800d028ba30c5e2a4ff84983c700b4e9175.tar.xz
fparkan-5be1b800d028ba30c5e2a4ff84983c700b4e9175.zip
feat(factory): register new designs in a running mission
Load control devices and visuals for saved Unit DAT designs, keep the project bytes pinned for later orders, and select mine reserve drafts by identity. The Field Camp runtime test registers a design without a startup reserve, supplies the factory from a new mine, and checks the released mounts and devices. Stock mission window starts with Vulkan validation clean. Connecting the in-game designer order and world rendering is the next step.
Diffstat (limited to 'crates/fparkan-runtime/src/lib.rs')
-rw-r--r--crates/fparkan-runtime/src/lib.rs53
1 files changed, 36 insertions, 17 deletions
diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs
index 2381c1ab..8b46ed97 100644
--- a/crates/fparkan-runtime/src/lib.rs
+++ b/crates/fparkan-runtime/src/lib.rs
@@ -217,6 +217,7 @@ pub use robot_designer::{
};
pub use saved_factory_projects::{
inspect_saved_factory_project, is_saved_factory_project_name, prepare_saved_factory_preview,
+ register_saved_factory_project,
};
pub use unit_combat::{
autonomous_firing_effect_phases, AutoDemoCombatEvent, AutoDemoProjectileType,
@@ -1059,6 +1060,37 @@ struct ControlDeviceProjection {
node_provider_status: MissionControlNodeProviderTableStatus,
}
+impl ControlDeviceProjection {
+ fn into_table(
+ self,
+ original_id: Option<OriginalObjectId>,
+ handle: ObjectHandle,
+ native_control_class: Option<MissionControlClassProjection>,
+ ) -> MissionControlDeviceTableState {
+ let projection = self;
+ MissionControlDeviceTableState {
+ original_id,
+ handle,
+ status: MissionControlDeviceTableStatus::Available(projection.devices),
+ native_control_class,
+ owner_profile: projection.owner_profile,
+ projectile_resistance_bits: projection.projectile_resistance_bits,
+ node_provider_maximum_amount_bits: initial_node_provider_maximum_amount(
+ &projection.node_provider_status,
+ ),
+ node_provider_amount_bits: initial_node_provider_amount(
+ &projection.node_provider_status,
+ ),
+ node_provider_dirty: true,
+ node_provider_depletion_marked: false,
+ node_provider_distribution_suspended: false,
+ current_output_rate_5dc_bits: 0,
+ current_output_rate_5e0_bits: 0,
+ node_provider_status: projection.node_provider_status,
+ }
+ }
+}
+
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
enum ControlLoadProfileSlot {
Absent,
@@ -2472,24 +2504,11 @@ fn load_mission_with_options(
&mut resolve_factory2_pair,
);
match projection {
- Ok(projection) => MissionControlDeviceTableState {
- original_id: draft.original_id,
- handle: *handle,
- status: MissionControlDeviceTableStatus::Available(projection.devices),
+ Ok(projection) => projection.into_table(
+ draft.original_id,
+ *handle,
native_control_class,
- owner_profile: projection.owner_profile,
- projectile_resistance_bits: projection.projectile_resistance_bits,
- node_provider_maximum_amount_bits: initial_node_provider_maximum_amount(
- &projection.node_provider_status,
- ),
- node_provider_amount_bits: initial_node_provider_amount(&projection.node_provider_status),
- node_provider_dirty: true,
- node_provider_depletion_marked: false,
-node_provider_distribution_suspended: false,
- current_output_rate_5dc_bits: 0,
- current_output_rate_5e0_bits: 0,
- node_provider_status: projection.node_provider_status,
- },
+ ),
Err(reason) => MissionControlDeviceTableState {
original_id: draft.original_id,
handle: *handle,