1
0
Fork 0

Fix creative search not take transl. into account

This commit is contained in:
Wuzzy 2020-04-25 14:31:01 +02:00
parent c81a18ac1a
commit 98988b1636
1 changed files with 9 additions and 1 deletions

View File

@ -94,9 +94,17 @@ local function set_inv_search(filter, player)
local playername = player:get_player_name() local playername = player:get_player_name()
local inv = minetest.get_inventory({type="detached", name="creative_"..playername}) local inv = minetest.get_inventory({type="detached", name="creative_"..playername})
local creative_list = {} local creative_list = {}
local lang = minetest.get_player_information(playername).lang_code
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 or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then
if string.find(string.lower(def.name), filter) or string.find(string.lower(def.description), filter) then local name = string.lower(def.name)
local desc
if not lang then
desc = string.lower(def.description)
else
desc = string.lower(minetest.get_translated_string(lang, def.description))
end
if string.find(name, filter) or string.find(desc, filter) then
table.insert(creative_list, name) table.insert(creative_list, name)
end end
end end