aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/robot_designer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/fparkan-runtime/src/robot_designer.rs')
-rw-r--r--crates/fparkan-runtime/src/robot_designer.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/fparkan-runtime/src/robot_designer.rs b/crates/fparkan-runtime/src/robot_designer.rs
index f196f9c1..10ee7a94 100644
--- a/crates/fparkan-runtime/src/robot_designer.rs
+++ b/crates/fparkan-runtime/src/robot_designer.rs
@@ -40,6 +40,15 @@ pub fn factory_design_parts(
Ok(parts)
}
+/// Writes replacements into a project being edited outside the factory catalogue.
+pub fn edit_factory_project(
+ project: &UnitDat,
+ changes: &[FactoryPartChange],
+) -> Result<Arc<[u8]>, EngineError> {
+ let records = factory_design_parts(&project.records, changes)?;
+ Ok(crate::designer_chassis::encode_project(project, &records))
+}
+
/// Checks the edited project against the current clan's research before transfer.
pub fn check_factory_design(
engine: &Engine,
@@ -666,7 +675,7 @@ mod tests {
.filter_map(|(index, part)| (key(&part.resource_raw) == b"i_c06_b_df").then_some(index))
.collect::<Vec<_>>();
assert_eq!(mounts.len(), 2);
- let variants = factory_part_variants(&engine, cockpit, scheme, mounts[0]).unwrap();
+ let variants = factory_part_variants(&engine, cockpit, &base, mounts[0]).unwrap();
assert_eq!(variants, ["i_c06_b_01", "i_c06_b_02", "i_c06_b_df"]);
let armor = base
.iter()