Typos and stuff

This commit is contained in:
Oversword 2021-03-29 03:59:08 +01:00
parent f287b668b7
commit d2ed87776a
4 changed files with 28 additions and 26 deletions

View File

@ -81,27 +81,29 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end end
end end
if clicked_category if clicked_category
and clicked_category ~= unified_inventory.current_category[player_name] then and clicked_category ~= unified_inventory.current_category[player_name] then
unified_inventory.current_category[player_name] = clicked_category unified_inventory.current_category[player_name] = clicked_category
unified_inventory.apply_filter(player, unified_inventory.current_searchbox[player_name], "nochange") unified_inventory.apply_filter(player, unified_inventory.current_searchbox[player_name], "nochange")
unified_inventory.set_inventory_formspec(player, unified_inventory.set_inventory_formspec(player,
unified_inventory.current_page[player_name]) unified_inventory.current_page[player_name])
end end
if fields.next_category then if fields.next_category then
local scroll = unified_inventory.current_category_scroll[player_name] + 1 local scroll = math.min(#unified_inventory.category_list-ui_peruser.pagecols, unified_inventory.current_category_scroll[player_name] + 1)
unified_inventory.current_category_scroll[player_name] = math.min(#unified_inventory.category_list-ui_peruser.pagecols, scroll) if scroll ~= unified_inventory.current_category_scroll[player_name] then
unified_inventory.set_inventory_formspec(player, unified_inventory.current_category_scroll[player_name] = scroll
unified_inventory.current_page[player_name]) unified_inventory.set_inventory_formspec(player,
unified_inventory.current_page[player_name])
end
end end
if fields.prev_category then if fields.prev_category then
local scroll = unified_inventory.current_category_scroll[player_name] - 1 local scroll = math.max(0, unified_inventory.current_category_scroll[player_name] - 1)
unified_inventory.current_category_scroll[player_name] = math.max(0, scroll) if scroll ~= unified_inventory.current_category_scroll[player_name] then
unified_inventory.set_inventory_formspec(player, unified_inventory.current_category_scroll[player_name] = scroll
unified_inventory.current_page[player_name]) unified_inventory.set_inventory_formspec(player,
unified_inventory.current_page[player_name])
end
end end
for i, def in pairs(unified_inventory.buttons) do for i, def in pairs(unified_inventory.buttons) do

View File

@ -12,7 +12,7 @@ function update_category_list()
index = -2, index = -2,
}) })
table.insert(category_list, { table.insert(category_list, {
name = "uncategorised", name = "uncategorized",
label = "Misc.", label = "Misc.",
symbol = "ui_no.png", symbol = "ui_no.png",
index = -1, index = -1,
@ -23,9 +23,8 @@ function update_category_list()
name = category, name = category,
label = def.label or category, label = def.label or category,
symbol = def.symbol, symbol = def.symbol,
index = index = def.index or -- sortby defined order
def.index or -- sortby defined order ((b1-64)*0.01)+((b2-64)*0.0001) -- or do a rudimentary alphabetical sort
((b1-64)*0.01)+((b2-64)*0.0001) -- or do a rhudimentary alphabetical sort
}) })
end end
table.sort(category_list, function (a,b) table.sort(category_list, function (a,b)

View File

@ -618,14 +618,15 @@ unified_inventory.add_category_items('lighting', {
"unified_inventory:bag_small", "unified_inventory:bag_small",
]] ]]
-- LIST UNCATEGORISED AFTER LOAD --[[ LIST UNCATEGORIZED AFTER LOAD
-- minetest.after(5, function ( ) minetest.after(5, function ( )
-- local l = {} local l = {}
-- for name,_ in pairs(minetest.registered_items) do for name,_ in pairs(minetest.registered_items) do
-- if not unified_inventory.find_category(name) then if not unified_inventory.find_category(name) then
-- table.insert(l, name) table.insert(l, name)
-- end end
-- end end
-- table.sort(l) table.sort(l)
-- minetest.log(table.concat(l, '",'.."\n"..'"')) minetest.log(table.concat(l, '",'.."\n"..'"'))
-- end) end)
]]

View File

@ -312,7 +312,7 @@ function ui.apply_filter(player, filter, search_dir)
table.insert(ui.filtered_items_list[player_name], name) table.insert(ui.filtered_items_list[player_name], name)
end end
end end
elseif category == 'uncategorised' then elseif category == 'uncategorized' then
for name, def in pairs(minetest.registered_items) do for name, def in pairs(minetest.registered_items) do
if (not ui.find_category(name)) if (not ui.find_category(name))
and (not def.groups.not_in_creative_inventory and (not def.groups.not_in_creative_inventory