Fix side-injection (techpack#85; tubelib#9; bls#294) by checking both dirs for validity instead of assuming second dir will always be valid

This commit is contained in:
Oversword 2021-06-06 22:31:52 +01:00
parent bb15c122f1
commit e44dd2e508

@ -163,11 +163,13 @@ function Tube:get_next_tube(pos, dir)
local val = Param2ToDir[param2 % 32] or 0
local dir1, dir2 = math.floor(val / 10), val % 10
local num_conn = math.floor(param2 / 32) or 0
if Turn180Deg[dir] == dir1 then
local odir = Turn180Deg[dir]
if odir == dir1 then
return npos, dir2, num_conn
else
elseif odir == dir2 then
return npos, dir1, num_conn
end
return
end
return self:get_next_teleport_node(pos, dir)
end