multidecor/decor_api/common_helpers.lua

14 lines
448 B
Lua

multidecor.helpers = {}
helpers = multidecor.helpers
-- Returns a direction of the node with 'pos' position
function helpers.get_dir(pos)
local node = minetest.get_node(pos)
local def = minetest.registered_nodes[node.name]
local dir = def.paramtype2 == "facedir" and vector.copy(minetest.facedir_to_dir(node.param2)) or
def.paramtype2 == "wallmounted" and vector.copy(minetest.wallmounted_to_dir(node.param2))
dir = dir*-1
return dir
end