[0.17.34] LuaTransportBelt.output_lines and .input_lines inconsistencies within splitters and underground belts

This subforum contains all the issues which we already resolved.
Post Reply
LeonSkills
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Feb 11, 2019 12:37 pm
Contact:

[0.17.34] LuaTransportBelt.output_lines and .input_lines inconsistencies within splitters and underground belts

Post by LeonSkills »

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):
Image

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:
Image

(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
)
Then just place a splitter, and an underground belt to see the connections within the entity in the console.

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
Underground belt doesn't print anything. No connections within the belt.


Maybe related: viewtopic.php?t=70199

Bilka
Factorio Staff
Factorio Staff
Posts: 2853
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.17.34] LuaTransportBelt.output_lines and .input_lines inconsistencies within splitters and underground belts

Post by Bilka »

LeonSkills wrote:
Wed May 01, 2019 5:02 pm
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 the only thing here that is a bug, and it is fixed for the next version.

The rest is just how things work inside the engine. The Lua API functions do nothing else than getting an existing property and converting it to the Lua state, so things like the underground belt is just how it works internally.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Resolved Problems and Bugs”