2019-07-02 23:22:47 +02:00
|
|
|
--[[
|
|
|
|
**********************************************
|
|
|
|
*** Helpfuntcions for cucina_vegana ***
|
|
|
|
**********************************************
|
|
|
|
]]--
|
|
|
|
|
|
|
|
function cucina_vegana.table_clone(c_table)
|
|
|
|
local t2 = {}
|
|
|
|
for k,v in pairs(c_table) do
|
|
|
|
t2[k] = v
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return t2
|
|
|
|
|
|
|
|
end -- function cucina_vegana.table_clone
|
|
|
|
|
|
|
|
function cucina_vegana.add_group(node, entry)
|
|
|
|
|
|
|
|
local newgroup = {}
|
|
|
|
|
|
|
|
if(type(node) ~= "string") then return end
|
|
|
|
|
|
|
|
-- Check the Item and get the group
|
2019-07-12 18:21:21 +02:00
|
|
|
if(minetest.registered_items[node] ~= nil) then
|
2019-07-02 23:22:47 +02:00
|
|
|
newgroup = cucina_vegana.table_clone(minetest.registered_items[node].groups)
|
|
|
|
|
2019-07-08 20:02:49 +02:00
|
|
|
elseif(minetest.registered_tools[node] ~= nil) then
|
|
|
|
newgroup = cucina_vegana.table_clone(minetest.registered_tools[node].groups)
|
2019-07-14 17:40:39 +02:00
|
|
|
|
|
|
|
else -- Node not found.
|
|
|
|
return
|
2019-07-02 23:22:47 +02:00
|
|
|
|
|
|
|
end -- if(minetest.registered_nodes
|
|
|
|
|
|
|
|
-- add the new groups to the item
|
|
|
|
local key, value
|
|
|
|
for key,value in pairs(entry) do
|
|
|
|
newgroup[key] = value
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.override_item(node, {
|
|
|
|
groups = newgroup
|
|
|
|
})
|
|
|
|
|
|
|
|
end -- function cucina_vegana.add_group()
|
|
|
|
|