mat9117
2019-04-14 a9b10cc4b10110a9c54bd03ac07eea3151b10ede
commit | author | age
2a2358 1
N 2 local S = technic.getter
3
dd65a6 4 technic.register_recipe_type("extracting", { description = S("Extracting") })
2a2358 5
N 6 function technic.register_extractor_recipe(data)
7     data.time = data.time or 4
aa8af0 8     technic.register_recipe("extracting", data)
2a2358 9 end
N 10
00f61d 11 if minetest.get_modpath("dye") then
T 12     -- check if we are using dye or unifieddyes
13     local unifieddyes = minetest.get_modpath("unifieddyes")
14
15     -- register recipes with the same crafting ratios as `dye` provides
16     local dye_recipes = {
17         {"technic:coal_dust",                 "dye:black 2"},
18         {"default:grass_1",                   "dye:green 1"},
19         {"default:dry_shrub",                 "dye:brown 1"},
20         {"default:junglegrass",               "dye:green 2"},
21         {"default:cactus",                    "dye:green 4"},
22         {"flowers:geranium",                  "dye:blue 4"},
23         {"flowers:dandelion_white",           "dye:white 4"},
24         {"flowers:dandelion_yellow",          "dye:yellow 4"},
25         {"flowers:tulip",                     "dye:orange 4"},
26         {"flowers:rose",                      "dye:red 4"},
27         {"flowers:viola",                     "dye:violet 4"},
28         {"bushes:blackberry",                 unifieddyes and "unifieddyes:magenta_s50 4" or "dye:violet 4"},
29         {"bushes:blueberry",                  unifieddyes and "unifieddyes:magenta_s50 4" or "dye:magenta 4"},
30     }
31
32     for _, data in ipairs(dye_recipes) do
33         technic.register_extractor_recipe({input = {data[1]}, output = data[2]})
34     end
35
36     -- overwrite the existing crafting recipes
37     local dyes = {"white", "red", "yellow", "blue", "violet", "orange"}
38     for _, color in ipairs(dyes) do
5b97d9 39         minetest.clear_craft({
D 40             type = "shapeless",
41             recipe = {"group:flower,color_"..color},
00f61d 42         })
5b97d9 43         minetest.register_craft({
D 44             type = "shapeless",
45             output = "dye:"..color.." 1",
46             recipe = {"group:flower,color_"..color},
47         })
00f61d 48     end
5b97d9 49
D 50     minetest.clear_craft({
51         type = "shapeless",
52         recipe = {"group:coal"},
53     })
00f61d 54     minetest.register_craft({
T 55         type = "shapeless",
56         output = "dye:black 1",
57         recipe = {"group:coal"},
58     })
59
60     if unifieddyes then
5b97d9 61         minetest.clear_craft({
D 62             type = "shapeless",
63             recipe = {"default:cactus"},
64         })
00f61d 65         minetest.register_craft({
T 66             type = "shapeless",
67             output = "dye:green 1",
68             recipe = {"default:cactus"},
69         })
70     end
71 end