Merge pull request #10 from oversword/issue-9

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:
Joachim Stolberg 2021-06-07 11:23:14 +02:00 committed by GitHub
commit 5104e57420
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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