Change sorting
This commit is contained in:
parent
093e95e1f2
commit
2a25487d2b
12
init.lua
12
init.lua
@ -116,9 +116,9 @@ local collect_items = function(filter, lang_code)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
--[[ Sort items in this order:
|
--[[ Sort items in this order:
|
||||||
* Nodes
|
|
||||||
* Tools
|
* Tools
|
||||||
* Craftitems
|
* Craftitems
|
||||||
|
* Nodes
|
||||||
* items from this mod (come last) ]]
|
* items from this mod (come last) ]]
|
||||||
local function compare(item1, item2)
|
local function compare(item1, item2)
|
||||||
local def1 = minetest.registered_items[item1]
|
local def1 = minetest.registered_items[item1]
|
||||||
@ -135,10 +135,6 @@ local collect_items = function(filter, lang_code)
|
|||||||
return false
|
return false
|
||||||
elseif not getitem1 and getitem2 then
|
elseif not getitem1 and getitem2 then
|
||||||
return true
|
return true
|
||||||
elseif node1 and not node2 then
|
|
||||||
return true
|
|
||||||
elseif not node1 and node2 then
|
|
||||||
return false
|
|
||||||
elseif tool1 and not tool2 then
|
elseif tool1 and not tool2 then
|
||||||
return true
|
return true
|
||||||
elseif not tool1 and tool2 then
|
elseif not tool1 and tool2 then
|
||||||
@ -147,6 +143,10 @@ local collect_items = function(filter, lang_code)
|
|||||||
return true
|
return true
|
||||||
elseif not craftitem1 and craftitem2 then
|
elseif not craftitem1 and craftitem2 then
|
||||||
return false
|
return false
|
||||||
|
elseif node1 and not node2 then
|
||||||
|
return true
|
||||||
|
elseif not node1 and node2 then
|
||||||
|
return false
|
||||||
else
|
else
|
||||||
return item1 < item2
|
return item1 < item2
|
||||||
end
|
end
|
||||||
@ -214,7 +214,7 @@ local function get_formspec(page, name)
|
|||||||
if current_max_pages[name] > 0 then
|
if current_max_pages[name] > 0 then
|
||||||
inventory_list = "list[detached:getitem_items_"..name..";main;0,0;"..SLOTS_W..","..SLOTS_H..";"..start.."]"
|
inventory_list = "list[detached:getitem_items_"..name..";main;0,0;"..SLOTS_W..","..SLOTS_H..";"..start.."]"
|
||||||
else
|
else
|
||||||
inventory_list = "label[3.5,2.5;"..F(S("No items found.")).."]"
|
inventory_list = "label[2.5,2.5;"..F(S("No items found.")).."]"
|
||||||
if search_text ~= "" then
|
if search_text ~= "" then
|
||||||
inventory_list = inventory_list .. "button[2.5,3.25;3,0.8;search_button_reset_big;"..F(S("Reset search")).."]"
|
inventory_list = inventory_list .. "button[2.5,3.25;3,0.8;search_button_reset_big;"..F(S("Reset search")).."]"
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user