CraftSystem: Case-insensitive search for crafting recipes
This commit is contained in:
@@ -84,13 +84,14 @@ end
|
|||||||
---@param pattern string
|
---@param pattern string
|
||||||
---@return CraftSystem.BaseCraft[]
|
---@return CraftSystem.BaseCraft[]
|
||||||
local function getMathedCrafts(crafts, pattern)
|
local function getMathedCrafts(crafts, pattern)
|
||||||
|
local pattern = string_utf8.lower(pattern)
|
||||||
local matchedCrafts = {}
|
local matchedCrafts = {}
|
||||||
|
|
||||||
for _, craft in ipairs(crafts) do
|
for _, craft in ipairs(crafts) do
|
||||||
local outputItem = ItemStack(craft.output)
|
local outputItem = ItemStack(craft.output)
|
||||||
local itemSettings = Smc.getItemDefinition(outputItem).settings
|
local itemSettings = Smc.getItemDefinition(outputItem).settings
|
||||||
local ruName = core.get_translated_string('ru', itemSettings._title)
|
local ruName = string_utf8.lower(core.get_translated_string('ru', itemSettings._title))
|
||||||
local enName = core.get_translated_string('en', itemSettings._title)
|
local enName = string_utf8.lower(core.get_translated_string('en', itemSettings._title))
|
||||||
|
|
||||||
if stringMatch(outputItem:get_name(), pattern) or
|
if stringMatch(outputItem:get_name(), pattern) or
|
||||||
stringMatch(ruName, pattern) or
|
stringMatch(ruName, pattern) or
|
||||||
|
|||||||
Reference in New Issue
Block a user