player: fix skins paging. crecipes: unlock hidden items if in any crafting recipe to get the recipes visible

This commit is contained in:
Alexander Weber 2017-06-19 10:33:03 +02:00
parent 1776f55ad6
commit cfba2ca7bb
2 changed files with 6 additions and 7 deletions

View File

@ -37,9 +37,6 @@ function crecipe_class:analyze()
return false
end
-- probably hidden therefore not indexed previous. But Items with recipe should be allways visible
cache.add_item(minetest.registered_items[self.out_item.name])
-- check recipe items/groups
for _, recipe_item in pairs(self._recipe.items) do
if recipe_item ~= "" then
@ -319,6 +316,8 @@ function crecipes.add_recipes_from_list(recipelist)
for _, recipe in ipairs(recipelist) do
local recipe_obj = crecipes.new(recipe)
if recipe_obj:analyze() then
-- probably hidden therefore not indexed previous. But Items with recipe should be allways visible
cache.add_item(minetest.registered_items[recipe_obj.out_item.name])
table.insert(cache.citems[recipe_obj.out_item.name].in_output_recipe, recipe)
crecipes.crecipes[recipe] = recipe_obj
if recipe_obj.recipe_type ~= "normal" then
@ -326,9 +325,8 @@ function crecipes.add_recipes_from_list(recipelist)
end
for _, entry in pairs(recipe_obj._items) do
for itemname, itemdef in pairs(entry.items) do
if cache.citems[itemname] then -- in case of"not_in_inventory" the item is not in citems
table.insert(cache.citems[itemname].in_craft_recipe, recipe)
end
cache.add_item(itemdef) -- probably hidden therefore not indexed previous. But Items with recipe should be allways visible
table.insert(cache.citems[itemname].in_craft_recipe, recipe)
cache.assign_to_group("ingredient:"..itemname, recipe_obj.out_item, filter.get("ingredient"))
end
end

View File

@ -169,8 +169,9 @@ local function update_page(state)
is_button = true,
size = { w = 0.87, h = 1.30 }
})
if skin:get_meta("_key") == cur_skin:get_meta("_key") then
if not state.param.skins_initial_page_adjusted and skin:get_meta("_key") == cur_skin:get_meta("_key") then
grid_skins:setFirstVisible(idx - 19) --8x5 (grid size) / 2 -1
state.param.skins_initial_page_adjusted = true
end
end
grid_skins:setList(skins_grid_data)