Add quaterdirection and fix multistation off by one errors

This commit is contained in:
hal8174 2025-01-26 22:16:12 +01:00
parent 1af9712bcb
commit c3bb980fcf
5 changed files with 137 additions and 47 deletions

View file

@ -23,7 +23,7 @@ fn main() {
]
.into_iter()
.flat_map(move |beltspeed| {
(0..6).flat_map(move |i| {
(0..2).flat_map(move |i| {
(0..=i).map(move |j| StationSpec {
locomotives: 1,
wagons: 1 << i,

View file

@ -152,7 +152,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
RailType::CurvedA,
Position::new(
inrail_x,
total_stacker_height + 4 + previous_station_heights,
total_stacker_height + 6 + previous_station_heights,
),
8,
));
@ -160,7 +160,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
RailType::CurvedB,
Position::new(
inrail_x + 4,
total_stacker_height + 14 + previous_station_heights,
total_stacker_height + 16 + previous_station_heights,
),
8,
));
@ -168,7 +168,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
RailType::CurvedB,
Position::new(
inrail_x + 12,
total_stacker_height + 22 + previous_station_heights,
total_stacker_height + 24 + previous_station_heights,
),
14,
));
@ -176,7 +176,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
RailType::CurvedA,
Position::new(
inrail_x + 22,
total_stacker_height + 26 + previous_station_heights,
total_stacker_height + 28 + previous_station_heights,
),
14,
));
@ -194,7 +194,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
RailType::CurvedA,
Position::new(
outrail_x,
total_stacker_height + 4 + previous_station_heights,
total_stacker_height + 6 + previous_station_heights,
),
10,
));
@ -202,7 +202,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
RailType::CurvedB,
Position::new(
outrail_x - 4,
total_stacker_height + 14 + previous_station_heights,
total_stacker_height + 16 + previous_station_heights,
),
10,
));
@ -210,7 +210,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
RailType::CurvedB,
Position::new(
outrail_x - 12,
total_stacker_height + 22 + previous_station_heights,
total_stacker_height + 24 + previous_station_heights,
),
4,
));
@ -218,7 +218,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
RailType::CurvedA,
Position::new(
outrail_x - 22,
total_stacker_height + 26 + previous_station_heights,
total_stacker_height + 28 + previous_station_heights,
),
4,
));
@ -237,7 +237,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
blueprint.add_entity(Entity::new_rail(
RailType::Straight,
Position::new(
inrail_x + 26 + 4 * j as PositionType,
inrail_x + 28 + 4 * j as PositionType,
28 + total_stacker_height + previous_station_heights,
),
4,
@ -529,7 +529,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
RailType::Straight,
Position::new(
inrail_x,
total_stacker_height + 2 + previous_station_heights + 4 * j as PositionType,
total_stacker_height + 4 + previous_station_heights + 4 * j as PositionType,
),
0,
));
@ -537,7 +537,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
RailType::Straight,
Position::new(
outrail_x,
total_stacker_height + 2 + previous_station_heights + 4 * j as PositionType,
total_stacker_height + 4 + previous_station_heights + 4 * j as PositionType,
),
0,
));
@ -567,12 +567,12 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
// output rails
blueprint.add_entity(Entity::new_rail(
RailType::CurvedA,
Position::new(outrail_x, total_stacker_height - 4),
Position::new(outrail_x, total_stacker_height - 2),
0,
));
blueprint.add_entity(Entity::new_rail(
RailType::CurvedB,
Position::new(outrail_x - 4, total_stacker_height - 14),
Position::new(outrail_x - 4, total_stacker_height - 12),
0,
));
let out_diagonal_length = (outrail_x - 54) / 4;
@ -581,7 +581,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
RailType::Straight,
Position::new(
outrail_x - 10 - 4 * i as PositionType,
total_stacker_height - 20 - 4 * i as PositionType,
total_stacker_height - 18 - 4 * i as PositionType,
),
6,
));
@ -627,5 +627,7 @@ pub fn multistation(stations: &[StationSpec], stacker_size: usize) -> Blueprint
}
}
blueprint.transform(Transformation::new(Direction::Right, Position::new(0, 0)));
blueprint
}