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
15
tube_api.lua
15
tube_api.lua
@ -13,7 +13,7 @@
|
||||
]]--
|
||||
|
||||
-- Version for compatibility checks, see readme.md/history
|
||||
tubelib2.version = 1.2
|
||||
tubelib2.version = 1.3
|
||||
|
||||
-- for lazy programmers
|
||||
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
|
||||
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
|
||||
-- legacy nodes corrupted tube line.
|
||||
function Tube:tool_repair_tube(pos)
|
||||
@ -349,4 +360,4 @@ end
|
||||
-- Used to change the tube nodes texture (e.g. on/off state)
|
||||
function Tube:switch_tube_line(pos, dir, state)
|
||||
self:switch_nodes(pos, dir, state)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user