In path_segment.lua replaced Vector2D.fromDirection(self.direction):reverse():toDirection() with DirectionHelper.reverseOf(self.direction)
function PathSegment:toEntitySpecs()
local type = EntityRoutingAttribute.from(self.name)
if type.isUnderground == false then
if self.distance == 1 then
return {
{ name = self.name, direction = self.direction, position = self.position }
}
else
-- although we basically don't include multiple onGround segments into one PathSegment, but I'll provide algorithm here
local out = {}
for dist = 0, self.distance - 1, 1 do
out[#out + 1] = { name = self.name, direction = self.direction, position = self.position + Vector2D.fromDirection(self.direction):scale(dist) }
end
return out
end
else
if type.lineType == TransportLineType.fluidLine then
local out = {}
-- Fixed: Use DirectionHelper.reverseOf() instead of reversing the vector
out[1] = { name = self.name, direction = DirectionHelper.reverseOf(self.direction), position = self.position }
if self.distance > 1 then
out[2] = { name = self.name, direction = self.direction, position = self.position + Vector2D.fromDirection(self.direction):scale(self.distance - 1) }
end
return out
else
if self.distance == 1 then
return {
{ name = self.name, direction = self.direction, position = self.position, type = self.type }
}
else
return {
{ name = self.name, direction = self.direction, position = self.position, type = "input" },
{ name = self.name, direction = self.direction, position = self.position + Vector2D.fromDirection(self.direction):scale(self.distance - 1), type = "output" }
}
end
end
end
end
The bug is in how the direction is being handled for the first underground pipe entity. Currently it's reversing both the vector AND converting it back to a direction, which results in incorrect rotation. It should only reverse the direction itself