From e1539e42e4c5007a6373e178a23d4d21c129eef4 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 5 Jan 2017 07:23:25 +0100 Subject: [PATCH] Remove bone meal after use --- mods/default/functions.lua | 14 ++- mods/dye/depends.txt | 2 +- mods/dye/init.lua | 186 +++++++++++++++++++++++++++---------- mods/flowers/init.lua | 7 +- 4 files changed, 157 insertions(+), 52 deletions(-) diff --git a/mods/default/functions.lua b/mods/default/functions.lua index 9145c9155..5846af76c 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -472,11 +472,12 @@ end) function duengen(pointed_thing) pos = pointed_thing.under n = minetest.get_node(pos) - if n.name == "" then return end + if n.name == "" then return false end local stage = "" if n.name == "default:sapling" then minetest.add_node(pos, {name="air"}) generate_tree(pos, "default:tree", "default:leaves", 1) + return true elseif string.find(n.name, "farming:wheat_") ~= nil then stage = string.sub(n.name, 15) if stage == "3" then @@ -486,6 +487,7 @@ function duengen(pointed_thing) else minetest.add_node(pos, {name="farming:wheat_"..math.random(2,3)}) end + return true elseif string.find(n.name, "farming:potato_") ~= nil then stage = tonumber(string.sub(n.name, 16)) if stage == 1 then @@ -493,6 +495,7 @@ function duengen(pointed_thing) else minetest.add_node(pos, {name="farming:potato"}) end + return true elseif string.find(n.name, "farming:carrot_") ~= nil then stage = tonumber(string.sub(n.name, 16)) if stage == 1 then @@ -500,6 +503,7 @@ function duengen(pointed_thing) else minetest.add_node(pos, {name="farming:carrot"}) end + return true elseif string.find(n.name, "farming:pumpkin_") ~= nil then stage = tonumber(string.sub(n.name, 17)) if stage == 1 then @@ -507,6 +511,7 @@ function duengen(pointed_thing) else minetest.add_node(pos, {name="farming:pumpkintige_unconnect"}) end + return true elseif string.find(n.name, "farming:melontige_") ~= nil then stage = tonumber(string.sub(n.name, 18)) if stage == 1 then @@ -514,13 +519,17 @@ function duengen(pointed_thing) else minetest.add_node(pos, {name="farming:melontige_unconnect"}) end + return true elseif n.name ~= "" and n.name == "default:junglesapling" then minetest.add_node(pos, {name="air"}) generate_tree(pos, "default:jungletree", "default:jungleleaves", 2) + return true elseif n.name ~="" and n.name == "default:reeds" then grow_reeds(pos) + return true elseif n.name ~="" and n.name == "default:cactus" then grow_cactus(pos) + return true elseif n.name == "default:dirt_with_grass" then for i = -2, 3, 1 do for j = -3, 2, 1 do @@ -539,6 +548,9 @@ function duengen(pointed_thing) end end end + return true + else + return false end end diff --git a/mods/dye/depends.txt b/mods/dye/depends.txt index 562cf6328..cfceaa86a 100644 --- a/mods/dye/depends.txt +++ b/mods/dye/depends.txt @@ -1 +1 @@ -default +flowers diff --git a/mods/dye/init.lua b/mods/dye/init.lua index aca98271c..bf7c6a28d 100644 --- a/mods/dye/init.lua +++ b/mods/dye/init.lua @@ -94,64 +94,154 @@ for _, row in ipairs(dyelocal.dyes) do groups = groups, stack_max = 64, }) - minetest.register_craft({ - type = "shapeless", - output = item_name.." 4", - recipe = {"group:flower,color_"..name}, - }) 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", { inventory_image = "dye_white.png", description = "Bone Meal", stack_max = 64, groups = {dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}, on_place = function(itemstack, user, pointed_thing) - duengen(pointed_thing) + if(duengen(pointed_thing)) then + itemstack:take_item() + end + return itemstack end, }) +-- Dye mixing minetest.register_craft({ - output = 'dye:lightblue', - recipe = { - {'flowers:blue_orchid'}, - } + type = "shapeless", + output = "dye:dark_grey 2", + 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"}}, }) diff --git a/mods/flowers/init.lua b/mods/flowers/init.lua index 32af37024..5a31b0013 100644 --- a/mods/flowers/init.lua +++ b/mods/flowers/init.lua @@ -36,8 +36,8 @@ local function add_simple_flower(name, desc, image, color) }) end -add_simple_flower("rose", "Poppy", "flowers_coqlicot", "color_red") -add_simple_flower("dandelion_yellow", "Yellow Dandelion", "flowers_dandelion_yellow", "color_yellow") +add_simple_flower("poppy", "Poppy", "flowers_coqlicot", "color_red") +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("tulip_orange", "Orange Tulip", "flower_tulip_orange", "color_orange") @@ -370,8 +370,11 @@ minetest.register_node("flowers:pot",{ end, }) + local time_to_load= os.clock() - init 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:paeonia", "flowers:peony") +minetest.register_alias("flowers:rose", "flowers:poppy") +minetest.register_alias("flowers:dandelion_yellow", "flowers:dandelion")