forked from acmgit/cucina_vegana
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tools.lua
79 lines (54 loc) · 2.5 KB
/
tools.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
--[[
**********************************************
*** 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
if(minetest.registered_items[node] ~= nil) then
newgroup = cucina_vegana.table_clone(minetest.registered_items[node].groups)
elseif(minetest.registered_tools[node] ~= nil) then
newgroup = cucina_vegana.table_clone(minetest.registered_tools[node].groups)
else -- Node not found.
return
end -- if(minetest.registered_nodes
-- add the new groups to the item
for key,value in pairs(entry) do
newgroup[key] = value
end
minetest.override_item(node, {
groups = newgroup
})
end -- function cucina_vegana.add_group()
function cucina_vegana.register_farming_ng(pname, step)
local germ = tonumber(cucina_vegana.plant_settings.germ_launch)
local modname = cucina_vegana.modname
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)
else
farmingNG.register_seed("cucina_vegana:seed_" .. pname, "cucina_vegana:seed_" .. pname)
farmingNG.register_harvest("cucina_vegana:" .. pname .. "_" .. step)
end -- if(germ > 0
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)
end -- if(germ > 0
end -- if cucina_vegana.farming_default
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.")
end -- cucina_vegana.register_farming_ng(