Allow for halve belts in multistation

This commit is contained in:
hal8174 2025-04-20 22:08:15 +02:00
parent cd86679d65
commit 06b01c2fe4
4 changed files with 24 additions and 6 deletions

View file

@ -9,7 +9,7 @@ struct Args {
#[arg(short, long)]
json: bool,
stacker_size: usize,
/// format: <locomotives>-<wagons>[lu][nfet]<lanes>
/// format: <locomotives>-<wagons>[lu][nfet]<lanes>[lr]?
stations: Vec<String>,
}
@ -26,7 +26,13 @@ fn main() {
let (load, s) = s.split_at_checked(1).expect("extracting direction");
let (beltspeed, lanes) = s.split_at_checked(1).expect("extracting lanes");
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, "")
};
StationSpec {
locomotives: locomotives.parse().expect("parsing locomotive count"),
@ -44,6 +50,12 @@ 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}"),
},
}
})
.collect::<Vec<_>>();