mirror of
https://github.com/joe7575/tubelib2.git
synced 2024-10-04 00:43:14 +02:00
new API function for Hopper like nodes added
This commit is contained in:
parent
b02e80c765
commit
5d2e9c49c2
13
tube_api.lua
13
tube_api.lua
@ -13,7 +13,7 @@
|
|||||||
]]--
|
]]--
|
||||||
|
|
||||||
-- Version for compatibility checks, see readme.md/history
|
-- Version for compatibility checks, see readme.md/history
|
||||||
tubelib2.version = 1.2
|
tubelib2.version = 1.3
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
@ -249,6 +249,17 @@ function Tube:get_connected_node_pos(pos, dir)
|
|||||||
return spos, fdir
|
return spos, fdir
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Check if node at given position is a tubelib2 compatible node,
|
||||||
|
-- able to receive and/or deliver items.
|
||||||
|
-- If dir == nil then node_pos = pos
|
||||||
|
-- Function returns the result (true/false), new pos, and the node
|
||||||
|
function Tube:compatible_node(pos, dir)
|
||||||
|
local npos = vector.add(pos, Dir6dToVector[dir or 0])
|
||||||
|
local node = self:get_node_lvm(npos)
|
||||||
|
return self.secondary_node_names[node.name], npos, node
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- To be called from a repair tool in the case of a "WorldEdit" or with
|
-- To be called from a repair tool in the case of a "WorldEdit" or with
|
||||||
-- legacy nodes corrupted tube line.
|
-- legacy nodes corrupted tube line.
|
||||||
function Tube:tool_repair_tube(pos)
|
function Tube:tool_repair_tube(pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user