David Leal
2020-06-24 6154a04c00d7650664b78e2bca37631ae3778411
commit | author | age
56e96b 1 local S = technic.getter
T 2 local moretrees = minetest.get_modpath("moretrees")
3 local dye = minetest.get_modpath("dye")
4
5 -- sawdust, the finest wood/tree grinding
6 local sawdust = "technic:sawdust"
7 minetest.register_craftitem(sawdust, {
8     description = S("Sawdust"),
9     inventory_image = "technic_sawdust.png",
10 })
11 minetest.register_craft({ type = "fuel", recipe = sawdust, burntime = 6 })
12 technic.register_compressor_recipe({ input = {sawdust .. " 4"}, output = "default:wood" })
13
14 -- tree/wood grindings
15 local function register_tree_grinding(name, tree, wood, extract, grinding_color)
16     local lname = string.lower(name)
17     lname = string.gsub(lname, ' ', '_')
18     local grindings_name = "technic:"..lname.."_grindings"
19     local inventory_image = "technic_"..lname.."_grindings.png"
20     if grinding_color then
21         inventory_image = inventory_image .. "^[colorize:" .. grinding_color
22     end
23     minetest.register_craftitem(grindings_name, {
24         description = S("%s Grinding"):format(S(name)),
25         inventory_image = inventory_image,
26     })
27     minetest.register_craft({
28         type = "fuel",
29         recipe = grindings_name,
30         burntime = 8,
31     })
32     technic.register_grinder_recipe({ input = { tree }, output = grindings_name .. " 4" })
33     technic.register_grinder_recipe({ input = { grindings_name }, output = sawdust .. " 4" })
34     if wood then
35         technic.register_grinder_recipe({ input = { wood }, output = grindings_name })
36     end
37     if extract then
38         technic.register_extractor_recipe({ input = { grindings_name .. " 4" }, output = extract})
39         technic.register_separating_recipe({
40             input = { grindings_name .. " 4" },
41             output = { sawdust .. " 4", extract }
42         })
43     end
44 end
45
46 local rubber_tree_planks = moretrees and "moretrees:rubber_tree_planks"
47 local default_extract = dye and "dye:brown 2"
48
49 local grinding_recipes = {
50     {"Common Tree",    "group:tree",                 "group:wood",        default_extract },
51     {"Rubber Tree",    "moretrees:rubber_tree_trunk",      rubber_tree_planks,     "technic:raw_latex"}
52 }
53
54 for _, data in pairs(grinding_recipes) do
55     register_tree_grinding(unpack(data))
56 end
57
58 if moretrees and dye then
59     -- https://en.wikipedia.org/wiki/Catechu ancient brown dye from the wood of acacia trees
60     register_tree_grinding("Acacia", "moretrees:acacia_trunk", "moretrees:acacia_planks", "dye:brown 8")
61 end