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