diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 04:53:53 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 04:53:53 +0300 |
| commit | 8e11cede8106e36aa1b91400318cff353c157986 (patch) | |
| tree | fb905d43a5500af6934821228f05badecbf2b9bc /crates/fparkan-runtime/src/production.rs | |
| parent | 6c2545e8b548a8b892ef2a3adaba1a138ab623c9 (diff) | |
| download | fparkan-8e11cede8106e36aa1b91400318cff353c157986.tar.xz fparkan-8e11cede8106e36aa1b91400318cff353c157986.zip | |
feat(ui): open and transfer recent factory designs
Diffstat (limited to 'crates/fparkan-runtime/src/production.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/production.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/production.rs b/crates/fparkan-runtime/src/production.rs index 3d3eb159..9f6846f8 100644 --- a/crates/fparkan-runtime/src/production.rs +++ b/crates/fparkan-runtime/src/production.rs @@ -387,6 +387,21 @@ pub fn clan_factory_schemes( .collect()) } +/// Components of a prepared player project, in the original Unit DAT order. +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 + .object_drafts + .get(production.reserve_start + scheme * RESERVE_SLOTS) + .map(|draft| draft.unit_components.as_slice()) +} + fn schemes_for_plant<'a>( mission: &'a LoadedMissionState, production: &'a Production, |
