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