mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-12-14 02:30:17 +01:00
Cleanup groups_to_items
This commit is contained in:
parent
74785bca5e
commit
1fb7790c4e
12
init.lua
12
init.lua
@ -734,21 +734,17 @@ end
|
|||||||
local function groups_to_items(groups, get_all)
|
local function groups_to_items(groups, get_all)
|
||||||
if not get_all and #groups == 1 then
|
if not get_all and #groups == 1 then
|
||||||
local group = groups[1]
|
local group = groups[1]
|
||||||
local def_gr = "default:" .. group
|
local stereotype = craftguide.group_stereotypes[group]
|
||||||
local stereotypes = craftguide.group_stereotypes
|
local def = reg_items[stereotype]
|
||||||
local stereotype = stereotypes and stereotypes[group]
|
|
||||||
stereotype = reg_items[stereotype] and stereotype
|
|
||||||
|
|
||||||
if stereotype then
|
if def and show_item(def) then
|
||||||
return stereotype
|
return stereotype
|
||||||
elseif reg_items[def_gr] then
|
|
||||||
return def_gr
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local names = {}
|
local names = {}
|
||||||
for name, def in pairs(reg_items) do
|
for name, def in pairs(reg_items) do
|
||||||
if item_has_groups(def.groups, groups) then
|
if show_item(def) and item_has_groups(def.groups, groups) then
|
||||||
if get_all then
|
if get_all then
|
||||||
names[#names + 1] = name
|
names[#names + 1] = name
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user