Change position format for blueprint

This commit is contained in:
hal8174 2025-01-22 23:04:13 +01:00
parent e969ba848b
commit fec7dd70db
6 changed files with 115 additions and 79 deletions

View file

@ -25,10 +25,11 @@ pub fn merger(
for j in 0..depth {
b.add_entity(Entity::new_belt(
stubspeed,
Position::new(
(intervall * (i + o * section_size)) as PositionType,
-(j as PositionType),
),
Position::new(1, 1)
+ 2 * Position::new(
(intervall * (i + o * section_size)) as PositionType,
-(j as PositionType),
),
match reverse {
true => Direction::Down,
false => Direction::Up,
@ -38,10 +39,11 @@ pub fn merger(
b.add_entity(Entity::new_belt(
stubspeed,
Position::new(
(intervall * (i + o * section_size)) as PositionType,
-(depth as PositionType),
),
Position::new(1, 1)
+ 2 * Position::new(
(intervall * (i + o * section_size)) as PositionType,
-(depth as PositionType),
),
match reverse {
true => Direction::Down,
false => Direction::Left,
@ -59,9 +61,10 @@ pub fn merger(
b.add_entity(Entity::new_splitter(
mergespeed,
Position::new(
(intervall * (j * p + o * section_size)) as PositionType
- i as PositionType,
0 - i as PositionType - depth as PositionType + !reverse as PositionType,
2 * ((intervall * (j * p + o * section_size)) as PositionType
- i as PositionType)
+ 1,
2 * (1 - i as PositionType - depth as PositionType),
),
match reverse {
true => Direction::Right,
@ -72,11 +75,12 @@ pub fn merger(
for l in 0..(7 * p / 2) {
b.add_entity(Entity::new_belt(
mergespeed.halve(),
Position::new(
(intervall * (j * p + o * section_size) + l + 1) as PositionType
- i as PositionType,
0 - i as PositionType - depth as PositionType,
),
Position::new(1, 1)
+ 2 * Position::new(
(intervall * (j * p + o * section_size) + l + 1) as PositionType
- i as PositionType,
0 - i as PositionType - depth as PositionType,
),
match reverse {
true => Direction::Right,
false => Direction::Left,
@ -91,10 +95,11 @@ pub fn merger(
for l in 0..(7 * o * section_size) {
b.add_entity(Entity::new_belt(
beltspeed,
Position::new(
l as PositionType - section_size.ilog2() as PositionType,
-(step as PositionType),
),
Position::new(1, 1)
+ 2 * Position::new(
l as PositionType - section_size.ilog2() as PositionType,
-(step as PositionType),
),
match reverse {
true => Direction::Right,
false => Direction::Left,