[0.17.34] LuaTransportBelt.output_lines and .input_lines inconsistencies within splitters and underground belts
Posted: Wed May 01, 2019 5:02 pm
Not a major bug. Just some inconsistencies which are easy to account for when building mods, but will cause some head-scratches the first time you encounter it.
If you check the input and output lines of the LuaTransportLines of a splitter then the connections within the splitter are inconsistent.
This is how the lines are indexed (with the corrected connections):

But when actually checking the input and output lines of each line we have that
5 and 7 are correctly output lines of 1 and 3,
6 and 8 are correctly output lines of 2 and 4,
1 and 3 are not input lines of 5 and 7,
2 and 4 are not input lines of 6 and 8,
5, 6, 7 and 8 are input lines to themselves, but 5 and 7 aren't output lines to themselves.
6 and 8 are output lines to 5, 6, 7 and 8
This is inconsistent and weird, unless I'm missing something (Like indexes/references changing midway).
An ingoing underground belt has 4 transport lines. However 1 and 3 aren't connected, neither are 2 and 4:

(Corrected picture as how the connections should be)
(Probably a technicality, but why does an ingoing underground have 4 transport lines?)
Some quick code to reproduce:
Then just place a splitter, and an underground belt to see the connections within the entity in the console.
Splitter output:
Underground belt doesn't print anything. No connections within the belt.
Maybe related: viewtopic.php?t=70199
If you check the input and output lines of the LuaTransportLines of a splitter then the connections within the splitter are inconsistent.
This is how the lines are indexed (with the corrected connections):

But when actually checking the input and output lines of each line we have that
5 and 7 are correctly output lines of 1 and 3,
6 and 8 are correctly output lines of 2 and 4,
1 and 3 are not input lines of 5 and 7,
2 and 4 are not input lines of 6 and 8,
5, 6, 7 and 8 are input lines to themselves, but 5 and 7 aren't output lines to themselves.
6 and 8 are output lines to 5, 6, 7 and 8
This is inconsistent and weird, unless I'm missing something (Like indexes/references changing midway).
An ingoing underground belt has 4 transport lines. However 1 and 3 aren't connected, neither are 2 and 4:

(Corrected picture as how the connections should be)
(Probably a technicality, but why does an ingoing underground have 4 transport lines?)
Some quick code to reproduce:
Code: Select all
script.on_event(defines.events.on_built_entity,function(event)
if event.created_entity.type == "splitter" or event.created_entity.type == "underground-belt" then
local belt = event.created_entity
for i = 1, belt.get_max_transport_line_index() do
local line = belt.get_transport_line(i)
for _, input in pairs(line.input_lines) do
for j = 1, belt.get_max_transport_line_index() do
if input == belt.get_transport_line(j) then
print(j .. " as input to " .. i)
end
end
end
for _, output in pairs(line.output_lines) do
for j = 1, belt.get_max_transport_line_index() do
if output == belt.get_transport_line(j) then
print(j .. " as output to " .. i)
end
end
end
end
end
end
)
Splitter output:
Code: Select all
5 as output to 1
7 as output to 1
6 as output to 2
8 as output to 2
5 as output to 3
7 as output to 3
6 as output to 4
8 as output to 4
5 as input to 5
6 as output to 5
8 as output to 5
6 as input to 6
6 as output to 6
8 as output to 6
7 as input to 7
6 as output to 7
8 as output to 7
8 as input to 8
6 as output to 8
8 as output to 8
Maybe related: viewtopic.php?t=70199