From 0ad190894afd8e9592ef182e36e16ee7a61483f6 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 2 Dec 2026 06:09:14 +0400 Subject: feat(ui): render assembled warbots in the designer --- crates/fparkan-runtime/src/production.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'crates/fparkan-runtime/src/production.rs') diff --git a/crates/fparkan-runtime/src/production.rs b/crates/fparkan-runtime/src/production.rs index 9f6846f8..ef1c0f38 100644 --- a/crates/fparkan-runtime/src/production.rs +++ b/crates/fparkan-runtime/src/production.rs @@ -392,16 +392,21 @@ pub fn factory_project_components( engine: &Engine, scheme: usize, ) -> Option<&[UnitComponentRecord]> { - let (mission, production) = loaded_production(engine).ok()?; - if scheme >= production.player_scheme_count { - return None; - } - mission + engine + .loaded + .as_ref()? .object_drafts - .get(production.reserve_start + scheme * RESERVE_SLOTS) + .get(factory_project_root(engine, scheme)?) .map(|draft| draft.unit_components.as_slice()) } +/// Index of the first prepared world root for a player factory project. +pub fn factory_project_root(engine: &Engine, scheme: usize) -> Option { + let (_, production) = loaded_production(engine).ok()?; + (scheme < production.player_scheme_count) + .then(|| production.reserve_start + scheme * RESERVE_SLOTS) +} + fn schemes_for_plant<'a>( mission: &'a LoadedMissionState, production: &'a Production, -- cgit v1.2.3