|
|
@ -1,11 +1,22 @@
|
|
|
|
use std::{
|
|
|
|
use std::{
|
|
|
|
fs::{self, File}, i32, io::{self, Write}, path::Path
|
|
|
|
fs::{self, File},
|
|
|
|
|
|
|
|
io::{self, Write},
|
|
|
|
|
|
|
|
path::Path,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
use crate::lw::{BinarySerializable, ComponentIdMap, ModVersion, Version};
|
|
|
|
use crate::lw::{BinarySerializable, ComponentIdMap, ModVersion, Version};
|
|
|
|
|
|
|
|
|
|
|
|
pub mod lw;
|
|
|
|
pub mod lw;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Convert component text id into numeric id
|
|
|
|
|
|
|
|
pub fn component_id(text_id: &str) -> i16 {
|
|
|
|
|
|
|
|
match text_id {
|
|
|
|
|
|
|
|
"MHG.CircuitBoard" => 1,
|
|
|
|
|
|
|
|
"MHG.AndGate" => 2,
|
|
|
|
|
|
|
|
_ => -1,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum SaveType {
|
|
|
|
enum SaveType {
|
|
|
|
_World = 1,
|
|
|
|
_World = 1,
|
|
|
|
Subassembly = 2,
|
|
|
|
Subassembly = 2,
|
|
|
@ -56,10 +67,16 @@ fn write_subassembly_file(
|
|
|
|
}];
|
|
|
|
}];
|
|
|
|
mods.write_to(file)?;
|
|
|
|
mods.write_to(file)?;
|
|
|
|
|
|
|
|
|
|
|
|
let component_id_map = vec![ComponentIdMap {
|
|
|
|
let component_id_map = vec![
|
|
|
|
numeric_id: 15,
|
|
|
|
ComponentIdMap {
|
|
|
|
|
|
|
|
numeric_id: 1,
|
|
|
|
text_id: "MHG.CircuitBoard".to_owned(),
|
|
|
|
text_id: "MHG.CircuitBoard".to_owned(),
|
|
|
|
}];
|
|
|
|
},
|
|
|
|
|
|
|
|
ComponentIdMap {
|
|
|
|
|
|
|
|
numeric_id: 2,
|
|
|
|
|
|
|
|
text_id: "MHG.AndGate".to_owned(),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
];
|
|
|
|
component_id_map.write_to(file)?;
|
|
|
|
component_id_map.write_to(file)?;
|
|
|
|
|
|
|
|
|
|
|
|
for component in components {
|
|
|
|
for component in components {
|
|
|
|