mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 21:41:50 +00:00
add pack filter by id
This commit is contained in:
parent
b06bbd3f7d
commit
ff652226fb
2 changed files with 5 additions and 5 deletions
|
|
@ -67,16 +67,16 @@ function refresh_search()
|
||||||
local new_included = table.copy(packs_included)
|
local new_included = table.copy(packs_included)
|
||||||
local new_excluded = table.copy(packs_excluded)
|
local new_excluded = table.copy(packs_excluded)
|
||||||
|
|
||||||
local function score(pack_name)
|
local function score(pack_id, pack_name)
|
||||||
if pack_name:lower():find(search_text) then
|
if pack_name:lower():find(search_text) or pack_id:lower():find(search_text) then
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local function sorting(a, b)
|
local function sorting(a, b)
|
||||||
local score_a = score(packs_info[a][2])
|
local score_a = score(a, packs_info[a][2])
|
||||||
local score_b = score(packs_info[b][2])
|
local score_b = score(b, packs_info[b][2])
|
||||||
|
|
||||||
if score_a ~= score_b then
|
if score_a ~= score_b then
|
||||||
return score_a > score_b
|
return score_a > score_b
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ function refresh_search()
|
||||||
local pos = content.pos
|
local pos = content.pos
|
||||||
local size = content.size
|
local size = content.size
|
||||||
|
|
||||||
if title:lower():find(search_text) or search_text == '' then
|
if title:lower():find(search_text) or id:lower():find(search_text) or search_text == '' then
|
||||||
content.enabled = true
|
content.enabled = true
|
||||||
content.pos = {pos[1], visible * (size[2] + interval) - step}
|
content.pos = {pos[1], visible * (size[2] + interval) - step}
|
||||||
visible = visible + 1
|
visible = visible + 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue