Fix non-showing item recipes

This commit is contained in:
taikedz 2016-12-22 21:47:07 +01:00 committed by JPG
parent d0b3cf2887
commit 69c6a3c739

@ -335,8 +335,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
data.pagenum = data.pagemax data.pagenum = data.pagemax
end end
craftguide:get_formspec(player_name) craftguide:get_formspec(player_name)
elseif next(fields):find(":") then else for item in pairs(fields) do
local item = next(fields) if item:find(":") then
if item:sub(-4) == "_inv" then if item:sub(-4) == "_inv" then
item = item:sub(1,-5) item = item:sub(1,-5)
end end
@ -347,12 +347,15 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if not recipes and not is_fuel then return end if not recipes and not is_fuel then return end
if progressive_mode then if progressive_mode then
local who = minetest.get_player_by_name(player_name) local who =
minetest.get_player_by_name(player_name)
local inv = who:get_inventory() local inv = who:get_inventory()
local _, has_item = craftguide:recipe_in_inv(inv, item) local _, has_item =
craftguide:recipe_in_inv(inv, item)
if not has_item then return end if not has_item then return end
recipes = craftguide:recipe_in_inv(inv, item, recipes) recipes = craftguide:recipe_in_inv(
inv, item, recipes)
end end
data.item = item data.item = item
@ -360,6 +363,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
data.recipes_item = recipes data.recipes_item = recipes
craftguide:get_formspec(player_name, is_fuel) craftguide:get_formspec(player_name, is_fuel)
end end
end
end
end) end)
minetest.register_craftitem("craftguide:book", { minetest.register_craftitem("craftguide:book", {