From 5a47a0834753dab151f3d3e9e60b52cd676a07e9 Mon Sep 17 00:00:00 2001 From: sys4-fr Date: Mon, 26 Mar 2018 19:36:46 +0200 Subject: [PATCH] Update nalc_lib mod --- custom/mods/nalc/nalc_lib/init.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/custom/mods/nalc/nalc_lib/init.lua b/custom/mods/nalc/nalc_lib/init.lua index 49cf47f..9620388 100644 --- a/custom/mods/nalc/nalc_lib/init.lua +++ b/custom/mods/nalc/nalc_lib/init.lua @@ -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")