mirror of
https://github.com/joe7575/tubelib2.git
synced 2024-07-15 12:19:34 +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,8 +291,11 @@ 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 not allow then
|
||||||
|
allowed[dir] = false
|
||||||
|
else
|
||||||
if preferred_pos and vector.equals(npos, preferred_pos) then
|
if preferred_pos and vector.equals(npos, preferred_pos) then
|
||||||
preferred_pos = nil
|
preferred_pos = nil
|
||||||
table.insert(tbl, 2, dir)
|
table.insert(tbl, 2, dir)
|
||||||
@ -297,6 +305,7 @@ function Tube:determine_tube_dirs(pos, preferred_pos, fdir)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- player pointed to an unknown node to force the tube orientation?
|
-- player pointed to an unknown node to force the tube orientation?
|
||||||
if preferred_pos and fdir then
|
if preferred_pos and fdir then
|
||||||
|
Loading…
Reference in New Issue
Block a user