mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-29 13:53:43 +01:00
Fix nil crash on un{craft,fuel}able items in output
This commit is contained in:
parent
128413ca04
commit
997b3c59bb
5
init.lua
5
init.lua
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
local craftguide, datas = {}, {}
|
local craftguide, datas = {}, {}
|
||||||
local progressive_mode = minetest.setting_getbool("craftguide_progressive_mode")
|
local progressive_mode = minetest.setting_getbool("craftguide_progressive_mode")
|
||||||
local min, max, floor, ceil = math.min, math.max, math.floor, math.ceil
|
local min, max, floor, ceil = math.min, math.max, math.floor, math.ceil
|
||||||
@ -281,6 +282,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
else for item in pairs(fields) do
|
else for item in pairs(fields) do
|
||||||
if not item:find(":") then return end
|
if not item:find(":") then return end
|
||||||
if item:sub(-4) == "_inv" then item = item:sub(1,-5) end
|
if item:sub(-4) == "_inv" then item = item:sub(1,-5) end
|
||||||
|
local recipes = minetest.get_all_craft_recipes(item)
|
||||||
|
if not recipes then return end
|
||||||
|
|
||||||
if progressive_mode then
|
if progressive_mode then
|
||||||
local _, player_has_item =
|
local _, player_has_item =
|
||||||
@ -290,7 +293,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
|
|
||||||
data.item = item
|
data.item = item
|
||||||
data.recipe_num = 1
|
data.recipe_num = 1
|
||||||
data.recipes_item = minetest.get_all_craft_recipes(item)
|
data.recipes_item = recipes
|
||||||
craftguide:get_formspec(player_name)
|
craftguide:get_formspec(player_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user