Add schedules and output as blueprint book
This commit is contained in:
parent
6ac0cab8d5
commit
3beab0c64d
3 changed files with 127 additions and 26 deletions
|
|
@ -1,9 +1,39 @@
|
|||
use factorio_blueprint::blueprint::{train::generate_train, BlueprintString};
|
||||
use factorio_blueprint::blueprint::{
|
||||
train::generate_train, BlueprintBook, BlueprintBookEntry, BlueprintString,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let b = generate_train(2, 4, true, true);
|
||||
let layouts = [
|
||||
(1, 1),
|
||||
(1, 2),
|
||||
(1, 4),
|
||||
(2, 4),
|
||||
(1, 8),
|
||||
(2, 8),
|
||||
(3, 8),
|
||||
(4, 8),
|
||||
];
|
||||
|
||||
let b = BlueprintString::Blueprint(b);
|
||||
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)
|
||||
.version(562949954797573)
|
||||
.build(),
|
||||
);
|
||||
|
||||
println!("{}", serde_json::to_string_pretty(&b).unwrap());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue