Add multistation generation
This commit is contained in:
parent
05f4edf83a
commit
ce76626f79
7 changed files with 451 additions and 10 deletions
54
factorio-blueprint-generator/src/bin/multistation.rs
Normal file
54
factorio-blueprint-generator/src/bin/multistation.rs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
use clap::Parser;
|
||||
use factorio_blueprint::{BlueprintString, encode};
|
||||
use factorio_blueprint_generator::multistation::{StationSpec, multistation};
|
||||
use factorio_core::beltoptions::Beltspeed;
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Args {
|
||||
#[arg(short, long)]
|
||||
json: bool,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Args::parse();
|
||||
|
||||
let stations: Vec<_> = (0..8)
|
||||
.map(|_| StationSpec {
|
||||
locomotives: 1,
|
||||
wagons: 2,
|
||||
load: false,
|
||||
beltspeed: Beltspeed::Normal,
|
||||
lanes: 1,
|
||||
})
|
||||
.collect();
|
||||
|
||||
let b = BlueprintString::Blueprint(
|
||||
multistation(
|
||||
&stations,
|
||||
// &[
|
||||
// StationSpec {
|
||||
// locomotives: 1,
|
||||
// wagons: 1,
|
||||
// load: false,
|
||||
// beltspeed: Beltspeed::Normal,
|
||||
// lanes: 1,
|
||||
// },
|
||||
// StationSpec {
|
||||
// locomotives: 1,
|
||||
// wagons: 1,
|
||||
// load: false,
|
||||
// beltspeed: Beltspeed::Express,
|
||||
// lanes: 1,
|
||||
// },
|
||||
// ],
|
||||
16,
|
||||
)
|
||||
.to_blueprint(),
|
||||
);
|
||||
|
||||
if args.json {
|
||||
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