Add recipe list. Correct tesseract labels.
This commit is contained in:
parent
2aa15f20a9
commit
04c6051e8a
3 changed files with 65 additions and 5 deletions
4
init.lua
4
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()
|
||||
|
|
10
nodes.lua
10
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"},
|
||||
|
|
56
recipe_list.lua
Normal file
56
recipe_list.lua
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue