summaryrefslogtreecommitdiff
path: root/builtin/misc.lua
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/misc.lua')
-rw-r--r--builtin/misc.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin/misc.lua b/builtin/misc.lua
index fd80aacf6..1d5e146c6 100644
--- a/builtin/misc.lua
+++ b/builtin/misc.lua
@@ -64,6 +64,16 @@ function minetest.hash_node_position(pos)
return (pos.z+32768)*65536*65536 + (pos.y+32768)*65536 + pos.x+32768
end
+function minetest.get_position_from_hash(hash)
+ local pos = {}
+ pos.x = (hash%65536) - 32768
+ hash = math.floor(hash/65536)
+ pos.y = (hash%65536) - 32768
+ hash = math.floor(hash/65536)
+ pos.z = (hash%65536) - 32768
+ return pos
+end
+
function minetest.get_item_group(name, group)
if not minetest.registered_items[name] or not
minetest.registered_items[name].groups[group] then