Refactor into different crates
This commit is contained in:
parent
94473c64e0
commit
dfdeae5638
82 changed files with 624 additions and 647 deletions
41
factorio-blueprint-generator/src/bin/train_blueprint.rs
Normal file
41
factorio-blueprint-generator/src/bin/train_blueprint.rs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
use factorio_blueprint::{BlueprintBook, BlueprintBookEntry, BlueprintString, encode};
|
||||
use factorio_blueprint_generator::train::generate_train;
|
||||
|
||||
fn main() {
|
||||
let layouts = [
|
||||
(1, 1),
|
||||
(1, 2),
|
||||
(1, 4),
|
||||
(2, 4),
|
||||
(1, 8),
|
||||
(2, 8),
|
||||
(3, 8),
|
||||
(4, 8),
|
||||
];
|
||||
|
||||
let mut b = Vec::new();
|
||||
|
||||
for (i, (locomotives, wagons)) in layouts.into_iter().enumerate() {
|
||||
b.push(BlueprintBookEntry::new(
|
||||
BlueprintString::Blueprint(generate_train(locomotives, wagons, true, false)),
|
||||
i as u32 * 2,
|
||||
));
|
||||
b.push(BlueprintBookEntry::new(
|
||||
BlueprintString::Blueprint(generate_train(locomotives, wagons, true, true)),
|
||||
i as u32 * 2 + 1,
|
||||
));
|
||||
}
|
||||
|
||||
let b = BlueprintString::BlueprintBook(
|
||||
BlueprintBook::builder()
|
||||
.blueprints(b)
|
||||
.active_index(0)
|
||||
.build(),
|
||||
);
|
||||
|
||||
// let b = BlueprintString::Blueprint(generate_train(1, 2, false, false));
|
||||
|
||||
println!("{}", serde_json::to_string_pretty(&b).unwrap());
|
||||
|
||||
println!("{}", encode(&serde_json::to_string(&b).unwrap()));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue