mirror of
https://github.com/minetest-mods/technic.git
synced 2024-09-30 00:00:42 +02:00
Fix error when technic is used with i3 and without craftguide mod. Optimalize code.
This commit is contained in:
parent
1b83798f4e
commit
2e19e5db63
|
@ -8,23 +8,25 @@ function technic.register_recipe_type(typename, origdata)
|
||||||
for k, v in pairs(origdata) do data[k] = v end
|
for k, v in pairs(origdata) do data[k] = v end
|
||||||
data.input_size = data.input_size or 1
|
data.input_size = data.input_size or 1
|
||||||
data.output_size = data.output_size or 1
|
data.output_size = data.output_size or 1
|
||||||
if have_ui and unified_inventory.register_craft_type and data.output_size == 1 then
|
if data.output_size == 1 then
|
||||||
|
if have_ui and unified_inventory.register_craft_type then
|
||||||
unified_inventory.register_craft_type(typename, {
|
unified_inventory.register_craft_type(typename, {
|
||||||
description = data.description,
|
description = data.description,
|
||||||
width = data.input_size,
|
width = data.input_size,
|
||||||
height = 1,
|
height = 1,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
if have_cg and craftguide.register_craft_type and data.output_size == 1 then
|
if have_cg and craftguide.register_craft_type then
|
||||||
craftguide.register_craft_type(typename, {
|
craftguide.register_craft_type(typename, {
|
||||||
description = data.description,
|
description = data.description,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
if have_i3 and i3.register_craft_type and data.output_size == 1 then
|
if have_i3 then
|
||||||
i3.register_craft_type(typename, {
|
i3.register_craft_type(typename, {
|
||||||
description = data.description,
|
description = data.description,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
data.recipes = {}
|
data.recipes = {}
|
||||||
technic.recipes[typename] = data
|
technic.recipes[typename] = data
|
||||||
end
|
end
|
||||||
|
@ -72,20 +74,13 @@ local function register_recipe(typename, data)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
if (have_cg or have_i3) and technic.recipes[typename].output_size == 1 then
|
if (have_cg or have_i3) and technic.recipes[typename].output_size == 1 then
|
||||||
if (craftguide.register_craft or have_i3) then
|
if (have_cg or have_i3) then
|
||||||
local result = data.output;
|
local result = data.output;
|
||||||
if (type(result)=="table") then
|
if (type(result)=="table") then
|
||||||
result = result[1];
|
result = result[1];
|
||||||
end
|
end
|
||||||
local items = "";
|
local items = table.concat(data.input, ", ");
|
||||||
for _, input in pairs(data.input) do
|
if have_cg and craftguide.register_craft then
|
||||||
if (items=="") then
|
|
||||||
items = items..input;
|
|
||||||
else
|
|
||||||
items = items..", "..input;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if craftguide.register_craft then
|
|
||||||
craftguide.register_craft({
|
craftguide.register_craft({
|
||||||
type = typename,
|
type = typename,
|
||||||
result = result,
|
result = result,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user