mirror of
https://github.com/joe7575/tubelib2.git
synced 2024-08-20 13:34:05 +02:00
Merge pull request #5 from oversword/issue-4
Refuse to connect with faces of a node which are not marked valid
This commit is contained in:
commit
0a826e1e00
@ -121,7 +121,12 @@ function Tube:get_secondary_node(pos, dir)
|
|||||||
local npos = vector.add(pos, Dir6dToVector[dir or 0])
|
local npos = vector.add(pos, Dir6dToVector[dir or 0])
|
||||||
local node = self:get_node_lvm(npos)
|
local node = self:get_node_lvm(npos)
|
||||||
if self.secondary_node_names[node.name] then
|
if self.secondary_node_names[node.name] then
|
||||||
return node, npos
|
local valid_dir_string = minetest.get_meta(npos):get_string('valid_dirs')
|
||||||
|
local valid_dirs = self.valid_dirs
|
||||||
|
if valid_dir_string and valid_dir_string ~= "" then
|
||||||
|
valid_dirs = minetest.deserialize(valid_dir_string)
|
||||||
|
end
|
||||||
|
return node, npos, valid_dirs[Turn180Deg[dir]] or false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -286,13 +291,17 @@ function Tube:determine_tube_dirs(pos, preferred_pos, fdir)
|
|||||||
-- Check for secondary nodes (chests and so on)
|
-- Check for secondary nodes (chests and so on)
|
||||||
for dir = 1,6 do
|
for dir = 1,6 do
|
||||||
if allowed[dir] then
|
if allowed[dir] then
|
||||||
local _,npos = self:get_secondary_node(pos, dir)
|
local _,npos,allow = self:get_secondary_node(pos, dir)
|
||||||
if npos then
|
if npos then
|
||||||
if preferred_pos and vector.equals(npos, preferred_pos) then
|
if not allow then
|
||||||
preferred_pos = nil
|
allowed[dir] = false
|
||||||
table.insert(tbl, 2, dir)
|
|
||||||
else
|
else
|
||||||
table.insert(tbl, dir)
|
if preferred_pos and vector.equals(npos, preferred_pos) then
|
||||||
|
preferred_pos = nil
|
||||||
|
table.insert(tbl, 2, dir)
|
||||||
|
else
|
||||||
|
table.insert(tbl, dir)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user