forked from minetest-mods/unified_inventory
fix excessive privilege check
This commit is contained in:
parent
86c73a4752
commit
2ab5a7c90a
|
@ -290,6 +290,7 @@ function unified_inventory.apply_filter(player, filter, search_dir)
|
||||||
return string.find(lname, lfilter, 1, true) or string.find(ldesc, lfilter, 1, true)
|
return string.find(lname, lfilter, 1, true) or string.find(ldesc, lfilter, 1, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local is_creative = unified_inventory.is_creative(player_name)
|
||||||
unified_inventory.filtered_items_list[player_name]={}
|
unified_inventory.filtered_items_list[player_name]={}
|
||||||
for name, def in pairs(minetest.registered_items) do
|
for name, def in pairs(minetest.registered_items) do
|
||||||
if (not def.groups.not_in_creative_inventory
|
if (not def.groups.not_in_creative_inventory
|
||||||
|
@ -297,8 +298,7 @@ function unified_inventory.apply_filter(player, filter, search_dir)
|
||||||
and def.description
|
and def.description
|
||||||
and def.description ~= ""
|
and def.description ~= ""
|
||||||
and ffilter(name, def)
|
and ffilter(name, def)
|
||||||
and (unified_inventory.is_creative(player_name)
|
and (is_creative or unified_inventory.crafts_for.recipe[def.name]) then
|
||||||
or unified_inventory.crafts_for.recipe[def.name]) then
|
|
||||||
table.insert(unified_inventory.filtered_items_list[player_name], name)
|
table.insert(unified_inventory.filtered_items_list[player_name], name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user