Update nalc_lib mod

This commit is contained in:
sys4-fr 2018-03-26 19:36:46 +02:00
parent 547426d507
commit 5a47a08347
1 changed files with 21 additions and 0 deletions

View File

@ -22,6 +22,27 @@ local function remove_group(name, group)
end
end
-- Add node to group
local function add_group(name, group, value)
local node = minetest.registered_nodes[name]
if node then
local groups = node.groups
if not groups then
groups = {}
end
groups[group] = value
minetest.log("action", "[nalc_lib] Add group "..group.."="..value.." to "..name)
minetest.override_item(name, {groups = groups})
end
end
-- Add a node in xp group
function nalc.def_xp(name, value)
add_group(name, "xp", value)
end
-- Remove node from group "oddly_breakable_by_hand"
function nalc.not_hand_breakable(name)
remove_group(name, "oddly_breakable_by_hand")