craftguide result count

This commit is contained in:
Evert Prants 2018-12-17 19:48:45 +02:00
parent d1f9449b84
commit 2ce8339f6f
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 13 additions and 18 deletions

View File

@ -4,6 +4,10 @@ local have_cg = minetest.get_modpath("craftguide") and craftguide and craftguide
elepm.craft = {}
elepm.craft.types = {}
local function item_string( ... )
-- body
end
function elepm.register_craft_type(name, def)
elepm.craft.types[name] = {
inputs = def.inputs or 2,
@ -78,16 +82,13 @@ function elepm.register_craft(craftdef)
if have_ui or have_cg then
local spec = {}
local items = {}
for item, count in pairs(recipe.recipe) do
spec[#spec+1] = ItemStack(item .. " " .. count)
end
local items = {}
for itm,q in pairs(recipe.recipe) do
local itmn = itm
if q > 1 then itmn = itmn .. " " .. q end
items[#items+1] = itmn
local stack = ItemStack(item)
stack:set_count(count)
spec[#spec+1] = stack
items[#items+1] = stack:to_string()
end
if type(recipe.output) == "table" then
@ -103,12 +104,9 @@ function elepm.register_craft(craftdef)
end
if have_cg then
local iname = itm
if type(iname) == "userdata" then iname = iname:get_name() end
craftguide.register_craft({
type = craftdef.type,
output = iname,
output = itmst:to_string(),
items = items,
})
end
@ -126,12 +124,9 @@ function elepm.register_craft(craftdef)
end
if have_cg then
local iname = recipe.output
if type(iname) == "userdata" then iname = iname:get_name() end
craftguide.register_craft({
type = craftdef.type,
output = iname,
output = recipe.output:to_string(),
items = items,
})
end

View File

@ -44,7 +44,7 @@ local alloy_recipes = {
},
{
recipe = { "default:copper_ingot 2", "moreores:silver_ingot" },
output = "basic_materials:brass_ingot",
output = "basic_materials:brass_ingot 3",
time = 8,
},
}