mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-09 00:53:45 +01:00
Straight ahead tubes can be placed my means of the "sneak" button
This commit is contained in:
parent
9118ade87c
commit
6ea13b9147
@ -250,30 +250,28 @@ local function update_tube(pos, dir, force_dir)
|
|||||||
local dir2 = nil
|
local dir2 = nil
|
||||||
-- use the predefined direction?
|
-- use the predefined direction?
|
||||||
if force_dir then
|
if force_dir then
|
||||||
dir1 = Turn180Deg[dir]
|
dir1 = force_dir
|
||||||
dir2 = force_dir
|
end
|
||||||
else
|
-- search on all 6 pos for up to 2 tubes with open holes or
|
||||||
-- search on all 6 pos for up to 2 tubes with open holes or
|
-- other tubelib compatible nodes
|
||||||
-- other tubelib compatible nodes
|
for ndir = 1,6 do
|
||||||
|
if not dir1 and is_connected(pos, ndir) then
|
||||||
|
dir1 = ndir
|
||||||
|
elseif not dir2 and is_connected(pos, ndir) and ndir ~= dir1 then
|
||||||
|
dir2 = ndir
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not force_dir and (not dir1 or not dir2) then
|
||||||
for ndir = 1,6 do
|
for ndir = 1,6 do
|
||||||
if not dir1 and is_connected(pos, ndir) then
|
if not dir1 and is_known_node(pos, ndir) then
|
||||||
dir1 = ndir
|
dir1 = ndir
|
||||||
elseif not dir2 and is_connected(pos, ndir) then
|
elseif not dir2 and is_known_node(pos, ndir) and ndir ~= dir1 then
|
||||||
dir2 = ndir
|
dir2 = ndir
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not dir1 or not dir2 then
|
|
||||||
for ndir = 1,6 do
|
|
||||||
if not dir1 and is_known_node(pos, ndir) then
|
|
||||||
dir1 = ndir
|
|
||||||
elseif not dir2 and is_known_node(pos, ndir) then
|
|
||||||
dir2 = ndir
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
dir1 = dir1 or dir
|
|
||||||
dir2 = dir2 or Turn180Deg[dir]
|
|
||||||
end
|
end
|
||||||
|
dir1 = dir1 or dir
|
||||||
|
dir2 = dir2 or Turn180Deg[dir]
|
||||||
local node_num, param2 = get_tube_number_and_param2(dir1, dir2)
|
local node_num, param2 = get_tube_number_and_param2(dir1, dir2)
|
||||||
swap_node(pos, node_num, param2)
|
swap_node(pos, node_num, param2)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user