Vanessa Ezekowitz
2013-10-26 4a35d5dd98c8c08dd79cd0d0789b902fd4470edf
commit | author | age
ee0765 1
S 2 technic.grinder_recipes = {}
3
4 function technic.register_grinder_recipe(data)
5     data.time = data.time or 3
6     technic.grinder_recipes[data.input] = data
7     if unified_inventory then
8         unified_inventory.register_craft({
9             type = "grinding",
10             output = data.output,
11             items = {data.input},
12             width = 0,
13         })
14     end
15 end
16
17 -- Receive an ItemStack of result by an ItemStack input
18 function technic.get_grinder_recipe(itemstack)
19     return technic.grinder_recipes[itemstack:get_name()]
20 end
21
22 -- Sorted alphebeticaly
23 local recipes = {
24     {"default:bronze_ingot",    "technic:bronze_dust 1"},
25     {"default:coal_lump",       "technic:coal_dust 2"},
26     {"default:cobble",          "default:gravel"},
27     {"default:copper_ingot",    "technic:copper_dust 1"},
28     {"default:copper_lump",     "technic:copper_dust 2"},
29     {"default:desert_stone",    "default:desert_sand"},
30     {"default:gold_ingot",      "technic:gold_dust 1"},
31     {"default:gold_lump",       "technic:gold_dust 2"},
32     {"default:gravel",          "default:dirt"},
33     {"default:iron_lump",       "technic:iron_dust 2"},
34     {"default:steel_ingot",     "technic:iron_dust 1"},
35     {"default:stone",           "default:sand"},
36     {"gloopores:alatro_lump",   "technic:alatro_dust 2"},
37     {"gloopores:kalite_lump",   "technic:kalite_dust 2"},
38     {"gloopores:arol_lump",     "technic:arol_dust 2"},
39     {"gloopores:talinite_lump", "technic:talinite_dust 2"},
40     {"gloopores:akalin_lump",   "technic:akalin_dust 2"},
41     {"moreores:mithril_ingot",  "technic:mithril_dust 1"},
42     {"moreores:mithril_lump",   "technic:mithril_dust 2"},
43     {"moreores:silver_ingot",   "technic:silver_dust 1"},
44     {"moreores:silver_lump",    "technic:silver_dust 2"},
45     {"moreores:tin_ingot",      "technic:tin_dust 1"},
46     {"moreores:tin_lump",       "technic:tin_dust 2"},
47     {"technic:chromium_ingot",  "technic:chromium_dust 1"},
48     {"technic:chromium_lump",   "technic:chromium_dust 2"},
768794 49     {"technic:zinc_ingot",      "technic:zinc_dust 1"},
ee0765 50     {"technic:zinc_lump",       "technic:zinc_dust 2"},
768794 51     {"technic:brass_ingot",     "technic:brass_dust 1"},
ee0765 52 }
S 53
54 if minetest.get_modpath("homedecor") then
55     table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"})
56 end
57
58 for _, data in pairs(recipes) do
59     technic.register_grinder_recipe({input=data[1], output=data[2]})
60 end
61
62 local function register_dust(name, ingot)
63     local lname = string.lower(name)
64     lname = string.gsub(lname, ' ', '_')
65     minetest.register_craftitem("technic:"..lname.."_dust", {
66         description = name.." Dust",
67         inventory_image = "technic_"..lname.."_dust.png",
68         on_place_on_ground = minetest.craftitem_place_item,
69     })
70     if ingot then
71         minetest.register_craft({
72             type = "cooking",
73             recipe = "technic:"..lname.."_dust",
74             output = ingot,
75         })
76     end
77 end
78
79 -- Sorted alphibeticaly
80 register_dust("Akalin",          "glooptest:akalin_ingot")
81 register_dust("Alatro",          "glooptest:alatro_ingot")
82 register_dust("Arol",            "glooptest:arol_ingot")
83 register_dust("Brass",           "technic:brass_ingot")
84 register_dust("Bronze",          "default:bronze_ingot")
85 register_dust("Chromium",        "technic:chromium_ingot")
86 register_dust("Coal",            nil)
87 register_dust("Copper",          "default:copper_ingot")
88 register_dust("Gold",            "default:gold_ingot")
89 register_dust("Iron",            "default:steel_ingot")
90 register_dust("Mithril",         "moreores:mithril_ingot")
91 register_dust("Silver",          "moreores:silver_ingot")
92 register_dust("Stainless Steel", "technic:stainless_steel_ingot")
93 register_dust("Talinite",        "glooptest:talinite_ingot")
94 register_dust("Tin",             "moreores:tin_ingot")
95 register_dust("Zinc",            "technic:zinc_ingot")
96