From 2b4d21160f1376b80068e2dec4fde3036fd9d6b4 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 8 Apr 2012 18:34:05 +0300 Subject: [PATCH] minetest.get_node_group(name, group) --- builtin/misc.lua | 7 +++++++ doc/lua_api.txt | 2 ++ 2 files changed, 9 insertions(+) diff --git a/builtin/misc.lua b/builtin/misc.lua index 01d5d1d4..23baca1c 100644 --- a/builtin/misc.lua +++ b/builtin/misc.lua @@ -55,4 +55,11 @@ function minetest.hash_node_position(pos) return (pos.z+32768)*65536*65536 + (pos.y+32768)*65536 + pos.x+32768 end +function minetest.get_node_group(name, group) + if not minetest.registered_nodes[name] or not + minetest.registered_nodes[name].groups[group] then + return 0 + end + return minetest.registered_nodes[name].groups[group] +end diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 9c70037a..3072b1f5 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -615,6 +615,8 @@ Random: minetest.get_connected_players() -> list of ObjectRefs minetest.hash_node_position({x=,y=,z=}) -> 48-bit integer ^ Gives a unique hash number for a node position (16+16+16=48bit) +minetest.get_node_group(name, group) -> rating +^ Get rating of a group of a node. (0 = not in group) Global objects: minetest.env - environment reference -- 2.30.2