diff --git a/init.lua b/init.lua index 4d46b26..69f1420 100644 --- a/init.lua +++ b/init.lua @@ -61,6 +61,8 @@ function fun_caves.clone_node(name) end +--dofile(fun_caves.path .. "/recipe_list.lua") + dofile(fun_caves.path .. "/abms.lua") dofile(fun_caves.path .. "/unionfind.lua") dofile(fun_caves.path .. "/nodes.lua") @@ -71,3 +73,5 @@ dofile(fun_caves.path .. "/mapgen.lua") if mobs and mobs.mod == "redo" then dofile(fun_caves.path .. "/mobs.lua") end + +--fun_caves.print_recipes() diff --git a/nodes.lua b/nodes.lua index 1be2cac..7c0fc51 100644 --- a/nodes.lua +++ b/nodes.lua @@ -169,7 +169,7 @@ local function teleporter(user, area, power) end minetest.register_craftitem("fun_caves:teleporter_iron_moonstone", { - description = "Iron and Moonstone Teleporter", + description = "Iron and Moonstone Tesseract", drawtype = "plantlike", paramtype = "light", tiles = {"fun_caves_tesseract_iron_moon.png"}, @@ -220,7 +220,7 @@ minetest.register_ore({ }) minetest.register_craftitem("fun_caves:teleporter_iron_coral", { - description = "Iron and Coral Teleporter", + description = "Iron and Coral Tesseract", drawtype = "plantlike", paramtype = "light", tiles = {"fun_caves_tesseract_iron_coral.png"}, @@ -259,7 +259,7 @@ minetest.register_craft({ }) minetest.register_craftitem("fun_caves:teleporter_iron_garnet", { - description = "Iron and Garnet Teleporter", + description = "Iron and Garnet Tesseract", drawtype = "plantlike", paramtype = "light", tiles = {"fun_caves_tesseract_iron_garnet.png"}, @@ -310,7 +310,7 @@ minetest.register_ore({ }) minetest.register_craftitem("fun_caves:teleporter_iron_zoisite", { - description = "Iron and Zoisite Teleporter", + description = "Iron and Zoisite Tesseract", drawtype = "plantlike", paramtype = "light", tiles = {"fun_caves_tesseract_iron_zois.png"}, @@ -361,7 +361,7 @@ minetest.register_ore({ }) minetest.register_craftitem("fun_caves:teleporter_iron_aquamarine", { - description = "Iron and Aquamarine Teleporter", + description = "Iron and Aquamarine Tesseract", drawtype = "plantlike", paramtype = "light", tiles = {"fun_caves_tesseract_iron_aqua.png"}, diff --git a/recipe_list.lua b/recipe_list.lua new file mode 100644 index 0000000..8881514 --- /dev/null +++ b/recipe_list.lua @@ -0,0 +1,56 @@ +local original_register_craft = minetest.register_craft +local craft_list = {} + +minetest.register_craft = function(recipe) + craft_list[#craft_list+1] = recipe + original_register_craft(recipe) +end + +local function get_name(inp) + inp = string.gsub(inp, ' [0-9]$', '') + local item = minetest.registered_items[inp] + if item and item.description then + return item.description + end + return inp +end + +fun_caves.print_recipes = function() + --print(dump(recipe)) + table.sort(craft_list, function(a, b) + if a.output and b.output and a.output < b.output then + return true + end + end) + for _, recipe in pairs(craft_list) do + if recipe.type == 'cooking' then + local input = get_name(recipe.recipe) + local output = get_name(recipe.output) + print('Cook '..input..' to produce '..output..'.') + elseif recipe.type == 'shapeless' then + local inputs = {} + for _, input in pairs(recipe.recipe) do + inputs[#inputs+1] = get_name(input) + end + local output = get_name(recipe.output) + print('Combine '..table.concat(inputs, ', ')..' to produce '..output..'.') + elseif recipe.type == 'fuel' then + -- nop + else + local output = get_name(recipe.output) + print('Combine the following to produce '..output..':') + for _, line in pairs(recipe.recipe) do + local out = {} + for _, input in pairs(line) do + input = get_name(input) + if input == '' then + input = '[empty]' + end + out[#out+1] = input + end + print(' '..table.concat(out, ', ')) + end + end + print() + end +end