Remove bone meal after use

This commit is contained in:
Wuzzy 2017-01-05 07:23:25 +01:00
parent 9b842c6909
commit e1539e42e4
4 changed files with 157 additions and 52 deletions

View file

@ -472,11 +472,12 @@ end)
function duengen(pointed_thing) function duengen(pointed_thing)
pos = pointed_thing.under pos = pointed_thing.under
n = minetest.get_node(pos) n = minetest.get_node(pos)
if n.name == "" then return end if n.name == "" then return false end
local stage = "" local stage = ""
if n.name == "default:sapling" then if n.name == "default:sapling" then
minetest.add_node(pos, {name="air"}) minetest.add_node(pos, {name="air"})
generate_tree(pos, "default:tree", "default:leaves", 1) generate_tree(pos, "default:tree", "default:leaves", 1)
return true
elseif string.find(n.name, "farming:wheat_") ~= nil then elseif string.find(n.name, "farming:wheat_") ~= nil then
stage = string.sub(n.name, 15) stage = string.sub(n.name, 15)
if stage == "3" then if stage == "3" then
@ -486,6 +487,7 @@ function duengen(pointed_thing)
else else
minetest.add_node(pos, {name="farming:wheat_"..math.random(2,3)}) minetest.add_node(pos, {name="farming:wheat_"..math.random(2,3)})
end end
return true
elseif string.find(n.name, "farming:potato_") ~= nil then elseif string.find(n.name, "farming:potato_") ~= nil then
stage = tonumber(string.sub(n.name, 16)) stage = tonumber(string.sub(n.name, 16))
if stage == 1 then if stage == 1 then
@ -493,6 +495,7 @@ function duengen(pointed_thing)
else else
minetest.add_node(pos, {name="farming:potato"}) minetest.add_node(pos, {name="farming:potato"})
end end
return true
elseif string.find(n.name, "farming:carrot_") ~= nil then elseif string.find(n.name, "farming:carrot_") ~= nil then
stage = tonumber(string.sub(n.name, 16)) stage = tonumber(string.sub(n.name, 16))
if stage == 1 then if stage == 1 then
@ -500,6 +503,7 @@ function duengen(pointed_thing)
else else
minetest.add_node(pos, {name="farming:carrot"}) minetest.add_node(pos, {name="farming:carrot"})
end end
return true
elseif string.find(n.name, "farming:pumpkin_") ~= nil then elseif string.find(n.name, "farming:pumpkin_") ~= nil then
stage = tonumber(string.sub(n.name, 17)) stage = tonumber(string.sub(n.name, 17))
if stage == 1 then if stage == 1 then
@ -507,6 +511,7 @@ function duengen(pointed_thing)
else else
minetest.add_node(pos, {name="farming:pumpkintige_unconnect"}) minetest.add_node(pos, {name="farming:pumpkintige_unconnect"})
end end
return true
elseif string.find(n.name, "farming:melontige_") ~= nil then elseif string.find(n.name, "farming:melontige_") ~= nil then
stage = tonumber(string.sub(n.name, 18)) stage = tonumber(string.sub(n.name, 18))
if stage == 1 then if stage == 1 then
@ -514,13 +519,17 @@ function duengen(pointed_thing)
else else
minetest.add_node(pos, {name="farming:melontige_unconnect"}) minetest.add_node(pos, {name="farming:melontige_unconnect"})
end end
return true
elseif n.name ~= "" and n.name == "default:junglesapling" then elseif n.name ~= "" and n.name == "default:junglesapling" then
minetest.add_node(pos, {name="air"}) minetest.add_node(pos, {name="air"})
generate_tree(pos, "default:jungletree", "default:jungleleaves", 2) generate_tree(pos, "default:jungletree", "default:jungleleaves", 2)
return true
elseif n.name ~="" and n.name == "default:reeds" then elseif n.name ~="" and n.name == "default:reeds" then
grow_reeds(pos) grow_reeds(pos)
return true
elseif n.name ~="" and n.name == "default:cactus" then elseif n.name ~="" and n.name == "default:cactus" then
grow_cactus(pos) grow_cactus(pos)
return true
elseif n.name == "default:dirt_with_grass" then elseif n.name == "default:dirt_with_grass" then
for i = -2, 3, 1 do for i = -2, 3, 1 do
for j = -3, 2, 1 do for j = -3, 2, 1 do
@ -539,6 +548,9 @@ function duengen(pointed_thing)
end end
end end
end end
return true
else
return false
end end
end end

View file

@ -1 +1 @@
default flowers

View file

@ -94,64 +94,154 @@ for _, row in ipairs(dyelocal.dyes) do
groups = groups, groups = groups,
stack_max = 64, stack_max = 64,
}) })
minetest.register_craft({
type = "shapeless",
output = item_name.." 4",
recipe = {"group:flower,color_"..name},
})
end end
-- Mix recipes
-- Just mix everything to everything somehow sanely
dyelocal.mixbases = {"magenta", "red", "orange", "brown", "yellow", "green", "dark_green", "cyan", "blue", "violet", "black", "dark_grey", "grey", "white", "lightblue"}
dyelocal.mixes = {
-- magenta, red, orange, brown, yellow, green, dark_green, cyan, blue, violet, black, dark_grey, grey, white, lightblue
lightblue ={ "violet", "violet", "orange", "orange", "green", "green", "green", "blue", "blue", "violet", "black", "grey", "grey", "lightblue", "lightblue" },
white = {"pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "lightblue", "violet", "grey", "grey", "white", "white" },
grey = {"pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "pink", "dark_grey","grey", "grey"},
dark_grey={"brown","brown", "brown", "brown", "brown","dark_green","dark_green","blue","blue","violet","black", "black"},
black = {"black", "black", "black", "black", "black", "black", "black", "black", "black", "black", "black"},
violet= {"magenta","magenta","red", "brown", "red", "cyan", "brown", "blue", "violet","violet"},
blue = {"violet", "magenta","brown","brown","dark_green","cyan","cyan", "cyan", "blue"},
cyan = {"blue","brown","dark_green","dark_grey","green","cyan","dark_green","cyan"},
dark_green={"brown","brown","brown", "brown", "green", "green", "dark_green"},
green = {"brown", "yellow","yellow","dark_green","green","green"},
yellow= {"red", "orange", "yellow","orange", "yellow"},
brown = {"brown", "brown","orange", "brown"},
orange= {"red", "orange","orange"},
red = {"magenta","red"},
magenta={"magenta"},
}
for one,results in pairs(dyelocal.mixes) do
for i,result in ipairs(results) do
local another = dyelocal.mixbases[i]
minetest.register_craft({
type = "shapeless",
output = 'dye:'..result..' 2',
recipe = {'dye:'..one, 'dye:'..another},
})
end
end
-- Hide dyelocal
dyelocal = nil
minetest.register_craftitem("dye:white", { minetest.register_craftitem("dye:white", {
inventory_image = "dye_white.png", inventory_image = "dye_white.png",
description = "Bone Meal", description = "Bone Meal",
stack_max = 64, stack_max = 64,
groups = {dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}, groups = {dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1},
on_place = function(itemstack, user, pointed_thing) on_place = function(itemstack, user, pointed_thing)
duengen(pointed_thing) if(duengen(pointed_thing)) then
itemstack:take_item()
end
return itemstack
end, end,
}) })
-- Dye mixing
minetest.register_craft({ minetest.register_craft({
output = 'dye:lightblue', type = "shapeless",
recipe = { output = "dye:dark_grey 2",
{'flowers:blue_orchid'}, recipe = {"dye:black", "dye:white"},
} })
minetest.register_craft({
type = "shapeless",
output = "dye:lightblue 2",
recipe = {"dye:blue", "dye:white"},
})
minetest.register_craft({
type = "shapeless",
output = "dye:grey 3",
recipe = {"dye:black", "dye:white", "dye:white"},
})
minetest.register_craft({
type = "shapeless",
output = "dye:grey 2",
recipe = {"dye:dark_grey", "dye:white"},
})
minetest.register_craft({
type = "shapeless",
output = "dye:green 2",
recipe = {"dye:dark_green", "dye:white"},
})
minetest.register_craft({
type = "shapeless",
output = "dye:magenta 4",
recipe = {"dye:blue", "dye:white", "dye:red", "dye:red"},
})
minetest.register_craft({
type = "shapeless",
output = "dye:pink 2",
recipe = {"dye:red", "dye:white"},
})
minetest.register_craft({
type = "shapeless",
output = "dye:cyan 2",
recipe = {"dye:blue", "dye:dark_green"},
})
minetest.register_craft({
type = "shapeless",
output = "dye:violet 2",
recipe = {"dye:blue", "dye:red"},
})
minetest.register_craft({
type = "shapeless",
output = "dye:orange 2",
recipe = {"dye:yellow", "dye:red"},
})
minetest.register_craft({
type = "shapeless",
output = "dye:magenta 2",
recipe = {"dye:violet", "dye:pink"},
})
minetest.register_craft({
type = "shapeless",
output = "dye:magenta 3",
recipe = {"dye:pink", "dye:red", "dye:blue"},
})
-- Dye creation
minetest.register_craft({
output = "dye:yellow",
recipe = {{"flowers:dandelion_yellow"}},
})
minetest.register_craft({
output = "dye:yellow 2",
recipe = {{"flowers:sunflower"}},
})
minetest.register_craft({
output = "dye:lightblue",
recipe = {{"flowers:blue_orchid"}},
})
minetest.register_craft({
output = "dye:grey",
recipe = {{"flowers:azure_bluet"}},
})
minetest.register_craft({
output = "dye:grey",
recipe = {{"flowers:oxeye_daisy"}},
})
minetest.register_craft({
output = "dye:grey",
recipe = {{"flowers:tulip_white"}},
})
minetest.register_craft({
output = "dye:magenta",
recipe = {{"flowers:allium"}},
})
minetest.register_craft({
output = "dye:magenta 2",
recipe = {{"flowers:lilac"}},
})
minetest.register_craft({
output = "dye:orange",
recipe = {{"flowers:tulip_orange"}},
})
minetest.register_craft({
output = "dye:pink",
recipe = {{"flowers:tulip_pink"}},
})
minetest.register_craft({
output = "dye:pink 2",
recipe = {{"flowers:peony"}},
})
minetest.register_craft({
output = "dye:red",
recipe = {{"flowers:poppy"}},
})
minetest.register_craft({
output = "dye:red",
recipe = {{"flowers:tulip_red"}},
})
minetest.register_craft({
output = "dye:red 2",
recipe = {{"flowers:rose_bush"}},
})
minetest.register_craft({
type = "cooking",
output = "dye:dark_green",
recipe = "default:cactus",
cooktime = 10,
})
minetest.register_craft({
output = "dye:white 3",
recipe = {{"default:bone"}},
})
minetest.register_craft({
output = "dye:white 9",
recipe = {{"default:boneblock"}},
}) })

View file

@ -36,8 +36,8 @@ local function add_simple_flower(name, desc, image, color)
}) })
end end
add_simple_flower("rose", "Poppy", "flowers_coqlicot", "color_red") add_simple_flower("poppy", "Poppy", "flowers_coqlicot", "color_red")
add_simple_flower("dandelion_yellow", "Yellow Dandelion", "flowers_dandelion_yellow", "color_yellow") add_simple_flower("dandelion", "Dandelion", "flowers_dandelion_yellow", "color_yellow")
add_simple_flower("oxeye_daisy", "Oxeye Daisy", "flower_oxeye_daisy", "color_yellow") add_simple_flower("oxeye_daisy", "Oxeye Daisy", "flower_oxeye_daisy", "color_yellow")
add_simple_flower("tulip_orange", "Orange Tulip", "flower_tulip_orange", "color_orange") add_simple_flower("tulip_orange", "Orange Tulip", "flower_tulip_orange", "color_orange")
@ -370,8 +370,11 @@ minetest.register_node("flowers:pot",{
end, end,
}) })
local time_to_load= os.clock() - init local time_to_load= os.clock() - init
print(string.format("[MOD] "..minetest.get_current_modname().." loaded in %.4f s", time_to_load)) print(string.format("[MOD] "..minetest.get_current_modname().." loaded in %.4f s", time_to_load))
minetest.register_alias("flowers:houstonia", "flowers:azure_bluet") minetest.register_alias("flowers:houstonia", "flowers:azure_bluet")
minetest.register_alias("flowers:paeonia", "flowers:peony") minetest.register_alias("flowers:paeonia", "flowers:peony")
minetest.register_alias("flowers:rose", "flowers:poppy")
minetest.register_alias("flowers:dandelion_yellow", "flowers:dandelion")