Add stacked belts to station
This commit is contained in:
parent
65e2c03824
commit
59d7cf50cb
5 changed files with 85 additions and 45 deletions
|
|
@ -2,7 +2,7 @@ use clap::Parser;
|
|||
use factorio_blueprint::abstraction::serde::AbstractBlueprintString;
|
||||
use factorio_blueprint::{BlueprintString, encode};
|
||||
use factorio_blueprint_generator::multistation::{StationSpec, multistation};
|
||||
use factorio_core::beltoptions::Beltspeed;
|
||||
use factorio_core::beltoptions::{Beltspeed, Belttype};
|
||||
use factorio_core::visualize::Visualize;
|
||||
|
||||
#[derive(Parser)]
|
||||
|
|
@ -29,11 +29,7 @@ fn main() {
|
|||
|
||||
let (beltspeed, s) = s.split_at_checked(1).expect("extracting lanes");
|
||||
|
||||
let (lanes, belttype) = if s.ends_with(['l', 'r']) {
|
||||
s.split_at(s.len() - 1)
|
||||
} else {
|
||||
(s, "")
|
||||
};
|
||||
let lanes = s.trim_end_matches(['r', 'l', 's']);
|
||||
|
||||
StationSpec {
|
||||
locomotives: locomotives.parse().expect("parsing locomotive count"),
|
||||
|
|
@ -51,12 +47,14 @@ fn main() {
|
|||
_ => panic!("unknown belt speed {beltspeed}"),
|
||||
},
|
||||
lanes: lanes.parse().expect("parsing lane count"),
|
||||
belttype: match belttype {
|
||||
"" => factorio_core::beltoptions::Belttype::Full,
|
||||
"r" => factorio_core::beltoptions::Belttype::Right,
|
||||
"l" => factorio_core::beltoptions::Belttype::Left,
|
||||
_ => panic!("unknown belttype {belttype}"),
|
||||
belttype: if s.contains('l') {
|
||||
Belttype::Left
|
||||
} else if s.contains('r') {
|
||||
Belttype::Right
|
||||
} else {
|
||||
Belttype::Full
|
||||
},
|
||||
stacked: s.contains('s'),
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ fn main() {
|
|||
o,
|
||||
beltspeed,
|
||||
Belttype::Full,
|
||||
false,
|
||||
);
|
||||
|
||||
inner_inner_b.push(BlueprintBookEntry::new(
|
||||
|
|
@ -94,10 +95,13 @@ fn main() {
|
|||
BlueprintBook::builder()
|
||||
.blueprints(inner_b)
|
||||
.active_index(0)
|
||||
.label(format!("{locomotives}-{cargo}-{}", match load {
|
||||
true => "load",
|
||||
false => "unload",
|
||||
}))
|
||||
.label(format!(
|
||||
"{locomotives}-{cargo}-{}",
|
||||
match load {
|
||||
true => "load",
|
||||
false => "unload",
|
||||
}
|
||||
))
|
||||
.build(),
|
||||
),
|
||||
2 * i as u32 + load as u32,
|
||||
|
|
@ -126,8 +130,16 @@ fn main() {
|
|||
belttype,
|
||||
} => {
|
||||
let b = BlueprintString::Blueprint(
|
||||
basic_station(load, locomotives, length, outputs, beltspeed, belttype)
|
||||
.to_blueprint(),
|
||||
basic_station(
|
||||
load,
|
||||
locomotives,
|
||||
length,
|
||||
outputs,
|
||||
beltspeed,
|
||||
belttype,
|
||||
false,
|
||||
)
|
||||
.to_blueprint(),
|
||||
);
|
||||
|
||||
if args.json {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue