mirror of
https://github.com/minetest-mods/i3.git
synced 2024-11-16 15:50:22 +01:00
Add small check
This commit is contained in:
parent
c1bd944465
commit
00042c77e1
7
init.lua
7
init.lua
|
@ -163,7 +163,7 @@ local function fmt(elem, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function clean_name(item)
|
local function clean_name(item)
|
||||||
if sub(item, 1, 1) == ":" or sub(item, 1, 1) == " " then
|
if sub(item, 1, 1) == ":" or sub(item, 1, 1) == " " or sub(item, 1, 1) == "_" then
|
||||||
item = sub(item, 2)
|
item = sub(item, 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -801,12 +801,13 @@ local function groups_to_items(groups, get_all)
|
||||||
local stereotype = group_stereotypes[group]
|
local stereotype = group_stereotypes[group]
|
||||||
local def = reg_items[stereotype]
|
local def = reg_items[stereotype]
|
||||||
|
|
||||||
if def and show_item(def) then
|
if show_item(def) then
|
||||||
return stereotype
|
return stereotype
|
||||||
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 show_item(def) and 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
|
||||||
|
@ -1102,11 +1103,13 @@ local function select_item(player, name, data, _f)
|
||||||
local i = 1
|
local i = 1
|
||||||
|
|
||||||
for _, v in ipairs(items) do
|
for _, v in ipairs(items) do
|
||||||
|
if show_item(reg_items[clean_name(v)]) then
|
||||||
insert(data.alt_items, idx + i, v)
|
insert(data.alt_items, idx + i, v)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if sub(item, 1, 1) == "_" then
|
if sub(item, 1, 1) == "_" then
|
||||||
item = sub(item, 2)
|
item = sub(item, 2)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user