Make tool crafting recipes more compact, move to tools.lua
authorMaksim <MoNTE48@mail.ua>
Mon, 16 Dec 2019 00:29:33 +0000 (01:29 +0100)
committerParamat <paramat@users.noreply.github.com>
Mon, 16 Dec 2019 00:29:33 +0000 (00:29 +0000)
mods/default/crafting.lua
mods/default/tools.lua

index 94811338df7802bd13f752f5e1fe65703505d1ef..e3a24f16cf20b531d8569496e29d015372a75ae1 100644 (file)
@@ -89,224 +89,6 @@ minetest.register_craft({
        }
 })
 
-minetest.register_craft({
-       output = "default:pick_wood",
-       recipe = {
-               {"group:wood", "group:wood", "group:wood"},
-               {"", "group:stick", ""},
-               {"", "group:stick", ""},
-       }
-})
-
-minetest.register_craft({
-       output = "default:pick_stone",
-       recipe = {
-               {"group:stone", "group:stone", "group:stone"},
-               {"", "group:stick", ""},
-               {"", "group:stick", ""},
-       }
-})
-
-minetest.register_craft({
-       output = "default:pick_steel",
-       recipe = {
-               {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
-               {"", "group:stick", ""},
-               {"", "group:stick", ""},
-       }
-})
-
-minetest.register_craft({
-       output = "default:pick_bronze",
-       recipe = {
-               {"default:bronze_ingot", "default:bronze_ingot", "default:bronze_ingot"},
-               {"", "group:stick", ""},
-               {"", "group:stick", ""},
-       }
-})
-
-minetest.register_craft({
-       output = "default:pick_mese",
-       recipe = {
-               {"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"},
-               {"", "group:stick", ""},
-               {"", "group:stick", ""},
-       }
-})
-
-minetest.register_craft({
-       output = "default:pick_diamond",
-       recipe = {
-               {"default:diamond", "default:diamond", "default:diamond"},
-               {"", "group:stick", ""},
-               {"", "group:stick", ""},
-       }
-})
-
-minetest.register_craft({
-       output = "default:shovel_wood",
-       recipe = {
-               {"group:wood"},
-               {"group:stick"},
-               {"group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:shovel_stone",
-       recipe = {
-               {"group:stone"},
-               {"group:stick"},
-               {"group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:shovel_steel",
-       recipe = {
-               {"default:steel_ingot"},
-               {"group:stick"},
-               {"group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:shovel_bronze",
-       recipe = {
-               {"default:bronze_ingot"},
-               {"group:stick"},
-               {"group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:shovel_mese",
-       recipe = {
-               {"default:mese_crystal"},
-               {"group:stick"},
-               {"group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:shovel_diamond",
-       recipe = {
-               {"default:diamond"},
-               {"group:stick"},
-               {"group:stick"},
-       }
-})
-
--- Axes
--- Recipes face left to match appearence in textures and inventory
-
-minetest.register_craft({
-       output = "default:axe_wood",
-       recipe = {
-               {"group:wood", "group:wood"},
-               {"group:wood", "group:stick"},
-               {"", "group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:axe_stone",
-       recipe = {
-               {"group:stone", "group:stone"},
-               {"group:stone", "group:stick"},
-               {"", "group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:axe_steel",
-       recipe = {
-               {"default:steel_ingot", "default:steel_ingot"},
-               {"default:steel_ingot", "group:stick"},
-               {"", "group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:axe_bronze",
-       recipe = {
-               {"default:bronze_ingot", "default:bronze_ingot"},
-               {"default:bronze_ingot", "group:stick"},
-               {"", "group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:axe_mese",
-       recipe = {
-               {"default:mese_crystal", "default:mese_crystal"},
-               {"default:mese_crystal", "group:stick"},
-               {"", "group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:axe_diamond",
-       recipe = {
-               {"default:diamond", "default:diamond"},
-               {"default:diamond", "group:stick"},
-               {"", "group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:sword_wood",
-       recipe = {
-               {"group:wood"},
-               {"group:wood"},
-               {"group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:sword_stone",
-       recipe = {
-               {"group:stone"},
-               {"group:stone"},
-               {"group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:sword_steel",
-       recipe = {
-               {"default:steel_ingot"},
-               {"default:steel_ingot"},
-               {"group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:sword_bronze",
-       recipe = {
-               {"default:bronze_ingot"},
-               {"default:bronze_ingot"},
-               {"group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:sword_mese",
-       recipe = {
-               {"default:mese_crystal"},
-               {"default:mese_crystal"},
-               {"group:stick"},
-       }
-})
-
-minetest.register_craft({
-       output = "default:sword_diamond",
-       recipe = {
-               {"default:diamond"},
-               {"default:diamond"},
-               {"group:stick"},
-       }
-})
 
 minetest.register_craft({
        output = "default:skeleton_key",
index d792d14aa8373ec6e46f71159870529e57b13d8d..d6261fc3ffcd3b1de184e394eea2aabe4dbe4d37 100644 (file)
@@ -402,6 +402,58 @@ minetest.register_tool("default:sword_diamond", {
        groups = {sword = 1}
 })
 
+--
+-- Register Craft Recipies
+--
+
+local craft_ingreds = {
+       wood = "group:wood",
+       stone = "group:stone",
+       steel = "default:steel_ingot",
+       bronze = "default:bronze_ingot",
+       mese = "default:mese_crystal",
+       diamond = "default:diamond"
+}
+
+for name, mat in pairs(craft_ingreds) do
+       minetest.register_craft({
+               output = "default:pick_".. name,
+               recipe = {
+                       {mat, mat, mat},
+                       {"", "group:stick", ""},
+                       {"", "group:stick", ""}
+               }
+       })
+
+       minetest.register_craft({
+               output = "default:shovel_".. name,
+               recipe = {
+                       {mat},
+                       {"group:stick"},
+                       {"group:stick"}
+               }
+       })
+
+       minetest.register_craft({
+               output = "default:axe_".. name,
+               recipe = {
+                       {mat, mat},
+                       {mat, "group:stick"},
+                       {"", "group:stick"}
+               }
+       })
+
+       minetest.register_craft({
+               output = "default:sword_".. name,
+               recipe = {
+                       {mat},
+                       {mat},
+                       {"group:stick"}
+               }
+       })
+end
+
+
 minetest.register_tool("default:key", {
        description = S("Key"),
        inventory_image = "default_key.png",