Fix subcat tabs’ scrollbar heights

This commit is contained in:
Jaidyn Ann 2024-01-10 00:41:30 -06:00
parent 4202980019
commit d05997413b

View File

@ -763,29 +763,22 @@ local function get_inventory_fs(player, data, fs)
end end
local awards_unlocked, award_list, award_list_nb = 0 local awards_unlocked, award_list, award_list_nb = 0
local max_val = damage_enabled and 12 or 7 local max_val = 0
max_val += (data.legacy_inventory and 2 or 0)
local bag_size = get_group(ItemStack(data.bag):get_name(), "bag") local bag_size = get_group(ItemStack(data.bag):get_name(), "bag")
if data.subcat == 1 and bag_size > 0 then -- Tweak scrollbar heights on a per-subcategory basis
max_val += min(32, 6 + ((bag_size - 1) * 10)) if data.subcat == 3 and bag_size > 0 then
max_val += min(0, ((bag_size - 1) * 10))
elseif i3.modules.armor and data.subcat == 2 then elseif i3.modules.skins and data.subcat == 4 then
if data.scrbar_inv >= max_val then
data.scrbar_inv += 10
end
max_val += 10
elseif i3.modules.skins and data.subcat == 3 then
local spp = 24 local spp = 24
local _skins = skins.get_skinlist_for_player(data.player_name) local _skins = skins.get_skinlist_for_player(data.player_name)
local nb = #_skins local nb = #_skins
local num = max(1, min(spp, nb - ((data.skin_pagenum - 1) * spp))) local num = max(1, min(spp, nb - ((data.skin_pagenum - 1) * spp)))
max_val += ceil(num / 3) * (nb > spp and 34 or 31) max_val += ceil(num / 3.5) * (nb > spp and 34 or 31)
elseif i3.modules.awards and data.subcat == 4 then elseif i3.modules.awards and data.subcat == 6 then
award_list = awards.get_award_states(data.player_name) award_list = awards.get_award_states(data.player_name)
award_list_nb = #award_list award_list_nb = #award_list