Add multistation generation

This commit is contained in:
hal8174 2025-01-24 23:25:43 +01:00
parent 05f4edf83a
commit ce76626f79
7 changed files with 451 additions and 10 deletions

View 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()));
}