Reversed faces direction, moved sides to tubelib2

This commit is contained in:
Cam B 2021-01-20 20:54:24 +00:00
parent 6555f95642
commit 29827a5487

@ -186,33 +186,13 @@ local function register_lbm(name, nodenames)
})
end
local DirToSide = {"B", "R", "F", "L", "D", "U"}
local function dir_to_side(dir, param2)
if dir < 5 then
dir = (((dir - 1) - (param2 % 4)) % 4) + 1
end
return DirToSide[dir]
end
local SideToDir = {B=1, R=2, F=3, L=4, D=5, U=6}
local function side_to_dir(side, param2)
local dir = SideToDir[side]
if dir < 5 then
dir = (((dir - 1) + (param2 % 4)) % 4) + 1
end
return dir
end
local function get_dest_node(pos, side)
local _,node = Tube:get_node(pos)
local dir = side_to_dir(side, node.param2)
local dir = tubelib2.side_to_dir(side, node.param2)
local spos, sdir = Tube:get_connected_node_pos(pos, dir)
if not (spos and sdir) then return end
_,node = Tube:get_node(spos)
local out_side = dir_to_side(tubelib2.Turn180Deg[sdir], node.param2)
local out_side = tubelib2.dir_to_side(tubelib2.Turn180Deg[sdir], node.param2)
return spos, out_side, Name2Name[node.name] or node.name
end