ShadowNinja
2013-07-17 ee0765804c0a21deeb2f33c22ac1a36cb0db5f43
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"},
49     {"technic:zinc_lump",       "technic:zinc_dust 2"},
50 }
51
52 if minetest.get_modpath("homedecor") then
53     table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"})
54 end
55
56 for _, data in pairs(recipes) do
57     technic.register_grinder_recipe({input=data[1], output=data[2]})
58 end
59
60 local function register_dust(name, ingot)
61     local lname = string.lower(name)
62     lname = string.gsub(lname, ' ', '_')
63     minetest.register_craftitem("technic:"..lname.."_dust", {
64         description = name.." Dust",
65         inventory_image = "technic_"..lname.."_dust.png",
66         on_place_on_ground = minetest.craftitem_place_item,
67     })
68     if ingot then
69         minetest.register_craft({
70             type = "cooking",
71             recipe = "technic:"..lname.."_dust",
72             output = ingot,
73         })
74     end
75 end
76
77 -- Sorted alphibeticaly
78 register_dust("Akalin",          "glooptest:akalin_ingot")
79 register_dust("Alatro",          "glooptest:alatro_ingot")
80 register_dust("Arol",            "glooptest:arol_ingot")
81 register_dust("Brass",           "technic:brass_ingot")
82 register_dust("Bronze",          "default:bronze_ingot")
83 register_dust("Chromium",        "technic:chromium_ingot")
84 register_dust("Coal",            nil)
85 register_dust("Copper",          "default:copper_ingot")
86 register_dust("Gold",            "default:gold_ingot")
87 register_dust("Iron",            "default:steel_ingot")
88 register_dust("Mithril",         "moreores:mithril_ingot")
89 register_dust("Silver",          "moreores:silver_ingot")
90 register_dust("Stainless Steel", "technic:stainless_steel_ingot")
91 register_dust("Talinite",        "glooptest:talinite_ingot")
92 register_dust("Tin",             "moreores:tin_ingot")
93 register_dust("Zinc",            "technic:zinc_ingot")
94