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
|
2019-07-16 22:59:13 +02:00
|
|
|
|
2019-07-02 23:22:47 +02:00
|
|
|
end
|
2019-07-16 22:59:13 +02:00
|
|
|
|
2019-07-02 23:22:47 +02:00
|
|
|
return t2
|
2019-07-16 22:59:13 +02:00
|
|
|
|
2019-07-02 23:22:47 +02:00
|
|
|
end -- function cucina_vegana.table_clone
|
|
|
|
|
|
|
|
function cucina_vegana.add_group(node, entry)
|
2019-07-16 22:59:13 +02:00
|
|
|
|
2019-07-17 22:44:09 +02:00
|
|
|
local newgroup
|
2019-07-16 22:59:13 +02:00
|
|
|
|
2019-07-02 23:22:47 +02:00
|
|
|
if(type(node) ~= "string") then return end
|
2019-07-16 22:59:13 +02:00
|
|
|
|
2019-07-02 23:22:47 +02:00
|
|
|
-- 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-16 22:59:13 +02:00
|
|
|
|
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-16 22:59:13 +02:00
|
|
|
|
2019-07-14 17:40:39 +02:00
|
|
|
else -- Node not found.
|
|
|
|
return
|
2019-07-16 22:59:13 +02:00
|
|
|
|
2019-07-02 23:22:47 +02:00
|
|
|
end -- if(minetest.registered_nodes
|
2019-07-16 22:59:13 +02:00
|
|
|
|
2019-07-02 23:22:47 +02:00
|
|
|
-- add the new groups to the item
|
|
|
|
for key,value in pairs(entry) do
|
|
|
|
newgroup[key] = value
|
2019-07-16 22:59:13 +02:00
|
|
|
|
2019-07-02 23:22:47 +02:00
|
|
|
end
|
2019-07-16 22:59:13 +02:00
|
|
|
|
2019-07-02 23:22:47 +02:00
|
|
|
minetest.override_item(node, {
|
|
|
|
groups = newgroup
|
|
|
|
})
|
|
|
|
|
|
|
|
end -- function cucina_vegana.add_group()
|
2020-03-04 21:18:20 +01:00
|
|
|
|
|
|
|
function cucina_vegana.register_farming_ng(pname, step)
|
|
|
|
local germ = tonumber(cucina_vegana.plant_settings.germ_launch)
|
|
|
|
local modname = cucina_vegana.modname
|
2020-03-11 06:04:39 +01:00
|
|
|
|
2020-03-04 21:18:20 +01:00
|
|
|
if cucina_vegana.farming_default then
|
|
|
|
if(germ > 0) then
|
|
|
|
farmingNG.register_seed("cucina_vegana:seed_" .. pname, "cucina_vegana:" .. pname .. "_" .. germ)
|
|
|
|
farmingNG.register_harvest("cucina_vegana:" .. pname .. "_" .. step)
|
2020-03-11 06:04:39 +01:00
|
|
|
|
2020-03-04 21:18:20 +01:00
|
|
|
else
|
|
|
|
farmingNG.register_seed("cucina_vegana:seed_" .. pname, "cucina_vegana:seed_" .. pname)
|
|
|
|
farmingNG.register_harvest("cucina_vegana:" .. pname .. "_" .. step)
|
2020-03-11 06:04:39 +01:00
|
|
|
|
2020-03-04 21:18:20 +01:00
|
|
|
end -- if(germ > 0
|
2020-03-11 06:04:39 +01:00
|
|
|
|
2020-03-04 21:18:20 +01:00
|
|
|
else
|
|
|
|
if(germ > 0) then
|
|
|
|
farmingNG.register_seed("cucina_vegana:" .. pname .. "_seed", "cucina_vegana:" .. pname .. "_" .. germ)
|
|
|
|
farmingNG.register_harvest("cucina_vegana:" .. pname .. "_" .. step)
|
|
|
|
|
|
|
|
else
|
|
|
|
farmingNG.register_seed("cucina_vegana:" .. pname .. "_seed", "cucina_vegana:" .. pname .. "_seed")
|
|
|
|
farmingNG.register_harvest("cucina_vegana:" .. pname .. "_" .. step)
|
2020-03-11 06:04:39 +01:00
|
|
|
|
2020-03-04 21:18:20 +01:00
|
|
|
end -- if(germ > 0
|
2020-03-11 06:04:39 +01:00
|
|
|
|
2020-03-04 21:18:20 +01:00
|
|
|
end -- if cucina_vegana.farming_default
|
2020-03-11 06:04:39 +01:00
|
|
|
|
2020-03-04 21:18:20 +01:00
|
|
|
print("info", "[MOD] " .. modname .. ": cucina_vegana:seed_" .. pname .. " at farming_nextgen registered.")
|
|
|
|
minetest.log("info", "[MOD] " .. modname .. ": cucina_vegana:seed_" .. pname .. " at farming_nextgen registered.")
|
2020-03-11 06:04:39 +01:00
|
|
|
|
2020-03-04 21:18:20 +01:00
|
|
|
end -- cucina_vegana.register_farming_ng(
|