From 7d39136764c894cb4adc3f0726f1df5eb6a4926b Mon Sep 17 00:00:00 2001 From: SmallJoker <SmallJoker@users.noreply.github.com> Date: Tue, 25 Oct 2022 18:03:51 +0200 Subject: [PATCH] Chainsaw: Partial rewrite, various improvements (#607) --- technic/machines/register/extractor_recipes.lua | 80 ++++++++++++++++++++++++++++++---------- 1 files changed, 60 insertions(+), 20 deletions(-) diff --git a/technic/machines/register/extractor_recipes.lua b/technic/machines/register/extractor_recipes.lua index f752144..ba43df5 100644 --- a/technic/machines/register/extractor_recipes.lua +++ b/technic/machines/register/extractor_recipes.lua @@ -8,25 +8,65 @@ technic.register_recipe("extracting", data) end -local recipes = { - -- Dyes - {"technic:coal_dust", "dye:black 2"}, - {"default:cactus", "dye:green 2"}, - {"default:dry_shrub", "dye:brown 2"}, - {"flowers:geranium", "dye:blue 2"}, - {"flowers:dandelion_white", "dye:white 2"}, - {"flowers:dandelion_yellow", "dye:yellow 2"}, - {"flowers:tulip", "dye:orange 2"}, - {"flowers:rose", "dye:red 2"}, - {"flowers:viola", "dye:violet 2"}, - - -- Rubber - {"technic:raw_latex", "technic:rubber 3"}, - {"moretrees:rubber_tree_trunk_empty", "technic:rubber"}, - {"moretrees:rubber_tree_trunk", "technic:rubber"}, -} +if minetest.get_modpath("dye") then + -- check if we are using dye or unifieddyes + local unifieddyes = minetest.get_modpath("unifieddyes") -for _, data in pairs(recipes) do - technic.register_extractor_recipe({input = {data[1]}, output = data[2]}) + -- register recipes with the same crafting ratios as `dye` provides + local dye_recipes = { + {"technic:coal_dust", "dye:black 2"}, + {"default:blueberries", "dye:violet 2"}, + {"default:grass_1", "dye:green 1"}, + {"default:dry_shrub", "dye:brown 1"}, + {"default:junglegrass", "dye:green 2"}, + {"default:cactus", "dye:green 4"}, + {"flowers:geranium", "dye:blue 4"}, + {"flowers:dandelion_white", "dye:white 4"}, + {"flowers:dandelion_yellow", "dye:yellow 4"}, + {"flowers:tulip", "dye:orange 4"}, + {"flowers:rose", "dye:red 4"}, + {"flowers:viola", "dye:violet 4"}, + {"bushes:blackberry", unifieddyes and "unifieddyes:magenta_s50 4" or "dye:violet 4"}, + {"bushes:blueberry", unifieddyes and "unifieddyes:magenta_s50 4" or "dye:magenta 4"}, + } + + for _, data in ipairs(dye_recipes) do + technic.register_extractor_recipe({input = {data[1]}, output = data[2]}) + end + + -- overwrite the existing crafting recipes + local dyes = {"white", "red", "yellow", "blue", "violet", "orange"} + for _, color in ipairs(dyes) do + minetest.clear_craft({ + type = "shapeless", + recipe = {"group:flower,color_"..color}, + }) + minetest.register_craft({ + type = "shapeless", + output = "dye:"..color.." 1", + recipe = {"group:flower,color_"..color}, + }) + end + + minetest.clear_craft({ + type = "shapeless", + recipe = {"group:coal"}, + }) + minetest.register_craft({ + type = "shapeless", + output = "dye:black 1", + recipe = {"group:coal"}, + }) + + if unifieddyes then + minetest.clear_craft({ + type = "shapeless", + recipe = {"default:cactus"}, + }) + minetest.register_craft({ + type = "shapeless", + output = "dye:green 1", + recipe = {"default:cactus"}, + }) + end end - -- Gitblit v1.8.0