Add loader station
This commit is contained in:
parent
b715c4ad06
commit
505ca6ff5c
12 changed files with 479 additions and 494 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use clap::{Parser, Subcommand};
|
||||
use factorio_blueprint::{BlueprintBook, BlueprintBookEntry, BlueprintString, encode};
|
||||
use factorio_blueprint_generator::station::basic_unload_station;
|
||||
use factorio_blueprint_generator::station::basic_station;
|
||||
use factorio_core::beltoptions::{Beltspeed, Belttype};
|
||||
|
||||
#[derive(Parser)]
|
||||
|
|
@ -13,6 +13,7 @@ struct Args {
|
|||
enum Command {
|
||||
Book,
|
||||
Single {
|
||||
load: bool,
|
||||
locomotives: usize,
|
||||
length: usize,
|
||||
outputs: usize,
|
||||
|
|
@ -41,27 +42,31 @@ fn main() {
|
|||
];
|
||||
|
||||
for (i, (locomotives, cargo)) in layouts.into_iter().enumerate() {
|
||||
let mut inner_b = Vec::new();
|
||||
for load in [false, true] {
|
||||
let mut inner_b = Vec::new();
|
||||
|
||||
let mut j = 0;
|
||||
for beltspeed in [
|
||||
Beltspeed::Normal,
|
||||
Beltspeed::Fast,
|
||||
Beltspeed::Express,
|
||||
Beltspeed::Turbo,
|
||||
] {
|
||||
let belttypes: &[_] = match beltspeed {
|
||||
Beltspeed::Normal => &[Belttype::Full, Belttype::Left, Belttype::Right],
|
||||
_ => &[Belttype::Full],
|
||||
};
|
||||
for &belttype in belttypes {
|
||||
for (j, beltspeed) in [
|
||||
Beltspeed::Normal,
|
||||
Beltspeed::Fast,
|
||||
Beltspeed::Express,
|
||||
Beltspeed::Turbo,
|
||||
]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
{
|
||||
let mut inner_inner_b = Vec::new();
|
||||
|
||||
for (l, o) in (0..=(cargo as u32).ilog2()).enumerate() {
|
||||
let o = 1 << o;
|
||||
|
||||
let blueprint =
|
||||
basic_unload_station(locomotives, cargo, o, beltspeed, belttype);
|
||||
let blueprint = basic_station(
|
||||
load,
|
||||
locomotives,
|
||||
cargo,
|
||||
o,
|
||||
beltspeed,
|
||||
Belttype::Full,
|
||||
);
|
||||
|
||||
inner_inner_b.push(BlueprintBookEntry::new(
|
||||
BlueprintString::Blueprint(blueprint),
|
||||
|
|
@ -74,25 +79,27 @@ fn main() {
|
|||
BlueprintBook::builder()
|
||||
.blueprints(inner_inner_b)
|
||||
.active_index(0)
|
||||
.label(format!("{:?}-{:?}", beltspeed, belttype))
|
||||
.label(format!("{:?}", beltspeed))
|
||||
.build(),
|
||||
),
|
||||
j,
|
||||
j as u32,
|
||||
));
|
||||
j += 1;
|
||||
}
|
||||
}
|
||||
|
||||
b.push(BlueprintBookEntry::new(
|
||||
BlueprintString::BlueprintBook(
|
||||
BlueprintBook::builder()
|
||||
.blueprints(inner_b)
|
||||
.active_index(0)
|
||||
.label(format!("{locomotives}-{cargo}"))
|
||||
.build(),
|
||||
),
|
||||
i as u32,
|
||||
));
|
||||
b.push(BlueprintBookEntry::new(
|
||||
BlueprintString::BlueprintBook(
|
||||
BlueprintBook::builder()
|
||||
.blueprints(inner_b)
|
||||
.active_index(0)
|
||||
.label(format!("{locomotives}-{cargo}-{}", match load {
|
||||
true => "load",
|
||||
false => "unload",
|
||||
}))
|
||||
.build(),
|
||||
),
|
||||
2 * i as u32 + load as u32,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
let b = BlueprintString::BlueprintBook(
|
||||
|
|
@ -105,13 +112,15 @@ fn main() {
|
|||
println!("{}", encode(&serde_json::to_string(&b).unwrap()));
|
||||
}
|
||||
Command::Single {
|
||||
load,
|
||||
locomotives,
|
||||
length,
|
||||
outputs,
|
||||
beltspeed,
|
||||
belttype,
|
||||
} => {
|
||||
let b = BlueprintString::Blueprint(basic_unload_station(
|
||||
let b = BlueprintString::Blueprint(basic_station(
|
||||
load,
|
||||
locomotives,
|
||||
length,
|
||||
outputs,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue