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