summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua30
1 files changed, 19 insertions, 11 deletions
diff --git a/init.lua b/init.lua
index 35526f8..1bb3917 100644
--- a/init.lua
+++ b/init.lua
@@ -295,61 +295,68 @@ end
function bonemeal:add_deco(list)
for l = 1, #list do
-
+
for n = 1, #deco do
-- update existing entry
if list[l][1] == deco[n][1] then
-
+
-- adding grass types
for _,extra in ipairs(list[l][2]) do
+
if extra ~= "" then
+
for __,entry in ipairs(deco[n][2]) do
+
if extra == entry then
extra = false
break
end
end
end
+
if extra then
table.insert(deco[n][2], extra)
end
end
-
+
-- adding decoration types
for _,extra in ipairs(list[l][3]) do
+
if extra ~= "" then
+
for __,entry in ipairs(deco[n][3]) do
+
if extra == entry then
extra = false
break
end
end
end
+
if extra then
table.insert(deco[n][3], extra)
end
end
-
+
list[l] = false
break
end
-
end
-
+
if list[l] then
table.insert(deco, list[l])
end
-
end
end
+
-- definitively set a decration scheme
-- this function will either add a new entry as is, or replace the existing one
function bonemeal:set_deco(list)
for l = 1, #list do
-
+
for n = 1, #deco do
-- replace existing entry
@@ -360,14 +367,14 @@ function bonemeal:set_deco(list)
break
end
end
-
+
if list[l] then
table.insert(deco, list[l])
end
-
end
end
+
-- global on_use function for bonemeal
function bonemeal:on_use(pos, strength, node)
@@ -455,6 +462,7 @@ minetest.register_craftitem("bonemeal:mulch", {
end,
})
+
-- bonemeal (strength 2)
minetest.register_craftitem("bonemeal:bonemeal", {
description = S("Bone Meal"),
@@ -588,4 +596,4 @@ local path = minetest.get_modpath("bonemeal")
dofile(path .. "/mods.lua")
dofile(path .. "/lucky_block.lua")
-print (S("[bonemeal] loaded"))
+print (S("[bonemeal] loaded")) \ No newline at end of file