From eb6a9b51495f7d3cdcd56b6a825f94d2f6734157 Mon Sep 17 00:00:00 2001 From: OgelGames Date: Mon, 16 Dec 2019 23:31:19 +1100 Subject: [PATCH] better fix for tree/wood grindings closes pandorabox-io/pandorabox.io#376 --- technic/machines/register/grindings.lua | 68 +++++++++++++++---------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/technic/machines/register/grindings.lua b/technic/machines/register/grindings.lua index 3aa8f10..4609d29 100644 --- a/technic/machines/register/grindings.lua +++ b/technic/machines/register/grindings.lua @@ -17,19 +17,21 @@ local function register_tree_grinding(name, tree, wood, extract, grinding_color) local lname = string.lower(name) lname = string.gsub(lname, ' ', '_') local grindings_name = "technic:"..lname.."_grindings" - local inventory_image = "technic_"..lname.."_grindings.png" - if grinding_color then - inventory_image = inventory_image .. "^[colorize:" .. grinding_color + if not minetest.registered_craftitems[grindings_name] then + local inventory_image = "technic_"..lname.."_grindings.png" + if grinding_color then + inventory_image = inventory_image .. "^[colorize:" .. grinding_color + end + minetest.register_craftitem(grindings_name, { + description = S("%s Grinding"):format(S(name)), + inventory_image = inventory_image, + }) + minetest.register_craft({ + type = "fuel", + recipe = grindings_name, + burntime = 8, + }) end - minetest.register_craftitem(grindings_name, { - description = S("%s Grinding"):format(S(name)), - inventory_image = inventory_image, - }) - minetest.register_craft({ - type = "fuel", - recipe = grindings_name, - burntime = 8, - }) technic.register_grinder_recipe({ input = { tree }, output = grindings_name .. " 4" }) technic.register_grinder_recipe({ input = { grindings_name }, output = sawdust .. " 4" }) if wood then @@ -47,22 +49,32 @@ end local rubber_tree_planks = moretrees and "moretrees:rubber_tree_planks" local default_extract = dye and "dye:brown 2" --- see: https://github.com/h-v-smacker/technic/blob/master/technic/machines/register/grindings.lua -local grinding_recipes = { - {"Common Tree", "group:tree", "group:wood", default_extract }, - {"Tree", "default:tree", "default:wood", default_extract }, - {"Aspen", "default:aspen_tree", "default:aspen_wood", default_extract }, - {"Jungletree", "default:jungletree", "default:junglewood", default_extract }, - {"Pine", "default:pine_tree", "default:pine_wood", default_extract }, - {"Rubber Tree", "moretrees:rubber_tree_trunk", rubber_tree_planks, "technic:raw_latex"}, - {"Rubber Tree", "moretrees:rubber_tree_trunk_empty", nil, "technic:raw_latex"} -} +-- https://en.wikipedia.org/wiki/Catechu ancient brown dye from the wood of acacia trees +local acacia_extract = dye and "dye:brown 8" -for _, data in pairs(grinding_recipes) do - register_tree_grinding(unpack(data)) -end +register_tree_grinding("Common Tree", "group:tree", "group:wood", default_extract) +register_tree_grinding("Common Tree", "default:tree", "default:wood", default_extract) +register_tree_grinding("Common Tree", "default:aspen_tree", "default:aspen_wood", default_extract) +register_tree_grinding("Common Tree", "default:jungletree", "default:junglewood", default_extract) +register_tree_grinding("Common Tree", "default:pine_tree", "default:pine_wood", default_extract) +register_tree_grinding("Rubber Tree", "moretrees:rubber_tree_trunk", rubber_tree_planks, "technic:raw_latex") +register_tree_grinding("Rubber Tree", "moretrees:rubber_tree_trunk_empty", nil, "technic:raw_latex") -if moretrees and dye then - -- https://en.wikipedia.org/wiki/Catechu ancient brown dye from the wood of acacia trees - register_tree_grinding("Acacia", "moretrees:acacia_trunk", "moretrees:acacia_planks", "dye:brown 8") +if moretrees then + register_tree_grinding("Common Tree", "moretrees:beech_tree_trunk", "moretrees:beech_tree_planks", default_extract) + register_tree_grinding("Common Tree", "moretrees:apple_tree_trunk", "moretrees:apple_tree_planks", default_extract) + register_tree_grinding("Common Tree", "moretrees:oak_tree_trunk", "moretrees:oak_tree_planks", default_extract) + register_tree_grinding("Common Tree", "moretrees:giant_sequoia_trunk", "moretrees:giant_sequoia_planks", default_extract) + register_tree_grinding("Common Tree", "moretrees:birch_tree_trunk", "moretrees:birch_tree_planks", default_extract) + register_tree_grinding("Common Tree", "moretrees:palm_tree_trunk", "moretrees:palm_tree_planks", default_extract) + register_tree_grinding("Common Tree", "moretrees:date_palm_tree_trunk", "moretrees:date_palm_tree_planks", default_extract) + register_tree_grinding("Common Tree", "moretrees:spruce_tree_trunk", "moretrees:spruce_tree_planks", default_extract) + register_tree_grinding("Common Tree", "moretrees:ceder_tree_trunk", "moretrees:ceder_tree_planks", default_extract) + register_tree_grinding("Common Tree", "moretrees:poplar_tree_trunk", "moretrees:poplar_tree_planks", default_extract) + register_tree_grinding("Common Tree", "moretrees:wollow_tree_trunk", "moretrees:wollow_tree_planks", default_extract) + register_tree_grinding("Common Tree", "moretrees:douglas_fir_trunk", "moretrees:douglas_fir_planks", default_extract) + + register_tree_grinding("Acacia", "moretrees:acacia_trunk", "moretrees:acacia_planks", acacia_extract) +else + register_tree_grinding("Acacia", "default:acacia_tree", "default:acacia_wood", acacia_extract) end