mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-09-27 14:20:21 +02:00
Refactor and speed up get_item_usages
This commit is contained in:
parent
4c1177ac26
commit
060caad104
8
init.lua
8
init.lua
|
@ -465,13 +465,8 @@ end
|
||||||
|
|
||||||
local function get_item_usages(item)
|
local function get_item_usages(item)
|
||||||
local usages = {}
|
local usages = {}
|
||||||
for name, def in pairs(reg_items) do
|
|
||||||
if not (def.groups.not_in_craft_guide == 1 or
|
|
||||||
def.groups.not_in_creative_inventory == 1) and
|
|
||||||
get_recipe(name).items and
|
|
||||||
def.description and def.description ~= "" then
|
|
||||||
|
|
||||||
local recipes = recipes_cache[name]
|
for _, recipes in pairs(recipes_cache) do
|
||||||
for i = 1, #recipes do
|
for i = 1, #recipes do
|
||||||
local recipe = recipes[i]
|
local recipe = recipes[i]
|
||||||
if item_in_recipe(item, recipe) then
|
if item_in_recipe(item, recipe) then
|
||||||
|
@ -479,7 +474,6 @@ local function get_item_usages(item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if fuel_cache[item] then
|
if fuel_cache[item] then
|
||||||
usages[#usages + 1] = {type = "fuel", width = 1, items = {item}}
|
usages[#usages + 1] = {type = "fuel", width = 1, items = {item}}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user