Update Access Point to show tool count when consolidated, add search/clear tooltips

This commit is contained in:
Zenon Seth 2023-11-16 11:19:03 +00:00
parent 7e3c8eaddb
commit c1b467ebaf
2 changed files with 9 additions and 2 deletions

View File

@ -75,7 +75,7 @@ local function add_list_to_itemmap(itemMap, list, useMetadata)
for _, stack in ipairs(list) do
if not stack:is_empty() then
local stackName = stack:get_name()
if useMetadata then stackName = stack:to_string() end
if useMetadata and stack:get_stack_max() == 1 then stackName = stack:to_string() end
if itemMap[stackName] == nil then itemMap[stackName] = 0 end
itemMap[stackName] = itemMap[stackName] + stack:get_count()
end
@ -110,6 +110,9 @@ local function build_stack_list(pos)
for item, count in pairs(itemMap) do
local stack = ItemStack(item)
stack:set_count(count)
if count > 1 and stack:get_stack_max() == 1 then
stack:get_meta():set_string("count_meta", tostring(count))
end
listSize = listSize + 1
itemList[listSize] = stack
end

View File

@ -40,12 +40,14 @@ local IMG_FILT_LIGHT = "logistica_icon_torch.png"
local ACCESS_POINT_TIMER = 1
local STR_METADATA_DESC = S("Toggle using metadata to display items:\nON = Differentiate items using metadata\nOFF = Group items only by name, ignore metadata")
local STR_METADATA_DESC = S("Applies to Tools only:\nON = Differentiate items using metadata\nOFF = Group items only by name, ignore metadata")
local STR_ALL_DESC = S("Show All items")
local STR_NODES_DESC = S("Show Nodes only")
local STR_CRAFT_DESC = S("Show Craft items only")
local STR_TOOLS_DESC = S("Show Tools only")
local STR_LIGHT_DESC = S("Show Light sources only")
local STR_SERCH_DESC = S("Search by text\nUse group:some_group to find items belongong to some_group")
local STR_CLEAR_DESC = S("Clear search")
local accessPointForms = {}
@ -111,6 +113,8 @@ local function get_access_point_formspec(pos, optMeta, playerName)
"field_close_on_enter["..SEARCH_FIELD..";false]"..
"image_button[8.1,6.5;0.8,0.8;logistica_icon_search.png;"..SEARCH_BTN..";;false;false;]"..
"image_button[9.2,6.5;0.8,0.8;logistica_icon_cancel.png;"..CLEAR_BTN..";;false;false;]"..
"tooltip["..SEARCH_BTN..";"..STR_SERCH_DESC .."]"..
"tooltip["..CLEAR_BTN..";"..STR_CLEAR_DESC.."]"..
"label[12.0,6.3;"..S("Page")..": "..pageInfo.curr.." / "..pageInfo.max.."]"..
"image_button[10.6,6.5;0.8,0.8;logistica_icon_first.png;"..FRST_BTN..";;false;false;]"..
"image_button[11.7,6.5;0.8,0.8;logistica_icon_prev.png;"..PREV_BTN..";;false;false;]"..