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