Remove all the legacy code (MT 5.6+ required)

This commit is contained in:
Jean-Patrick Guerrero 2022-08-01 03:57:32 +02:00
parent 326ee3e098
commit a3fea93a09
2 changed files with 9 additions and 19 deletions

View File

@ -27,7 +27,7 @@ i3 = {
debug_mode = false, debug_mode = false,
max_favs = 6, max_favs = 6,
max_waypoints = 30, max_waypoints = 30,
min_fs_version = 4, min_fs_version = 6,
item_btn_size = 1.1, item_btn_size = 1.1,
drop_bag_on_die = true, drop_bag_on_die = true,
save_interval = 600, -- Player data save interval (in seconds) save_interval = 600, -- Player data save interval (in seconds)

View File

@ -670,7 +670,7 @@ local function get_inventory_fs(player, data, fs)
--fs("style[player_model;bgcolor=black]") --fs("style[player_model;bgcolor=black]")
model(0.2, 0.2, armor_skin and 4 or 3.4, ctn_hgt, model(0.2, 0.2, armor_skin and 4 or 3.4, ctn_hgt,
"player_model", props.mesh, textures, "0,-150", "false", "false", "player_model", props.mesh, textures, "0,-150", "false", "false",
fmt("%u,%u%s", anim.x, anim.y, data.fs_version >= 5 and ";30" or "")) fmt("%u,%u;30", anim.x, anim.y))
else else
local size = 2.5 local size = 2.5
image(0.7, 0.2, size, size * props.visual_size.y, props.textures[1]) image(0.7, 0.2, size, size * props.visual_size.y, props.textures[1])
@ -1335,7 +1335,7 @@ local function get_items_fs(fs, data, player, full_height)
fs"style_type[label;font=italic;font_size=18]" fs"style_type[label;font=italic;font_size=18]"
label(data.inv_width + 0.9, 0.49, clr("#aaa", ES"Search...")) label(data.inv_width + 0.9, 0.49, clr("#aaa", ES"Search..."))
fs(fmt("style[enable_search:hovered;bgimg=%s]", PNG.search_outline)) fs(fmt("style[enable_search:hovered;bgimg=%s]", PNG.search_outline))
button(data.inv_width + 0.8, 0.1, 4, 0.8, "enable_search", "") button(data.inv_width + 0.8, 0.12, 4, 0.8, "enable_search", "")
end end
image_button(data.inv_width + 0.35, 0.32, 0.35, 0.35, "", "search", "") image_button(data.inv_width + 0.35, 0.32, 0.35, 0.35, "", "search", "")
@ -1397,18 +1397,13 @@ local function get_items_fs(fs, data, player, full_height)
local _tabs = {"All", "Nodes", "Items"} local _tabs = {"All", "Nodes", "Items"}
local tab_len, tab_hgh = 1.8, 0.5 local tab_len, tab_hgh = 1.8, 0.5
local legacy_fs = data.fs_version < 6
for i, title in ipairs(_tabs) do for i, title in ipairs(_tabs) do
local selected = i == data.itab local selected = i == data.itab
local hover_texture = selected and PNG.tab_small_hover or PNG.tab_small local hover_texture = selected and PNG.tab_small_hover or PNG.tab_small
if legacy_fs then
fs(fmt("style_type[image_button;fgimg=%s;fgimg_hovered=%s]", hover_texture, PNG.tab_small_hover))
else
fs(fmt([[style_type[image_button;bgimg=%s;bgimg_hovered=%s; fs(fmt([[style_type[image_button;bgimg=%s;bgimg_hovered=%s;
bgimg_middle=14,0,-14,-14;padding=-14,0,14,14] ]], hover_texture, PNG.tab_small_hover)) bgimg_middle=14,0,-14,-14;padding=-14,0,14,14] ]], hover_texture, PNG.tab_small_hover))
end
fs(fmt("style_type[image_button;noclip=true;font_size=16;textcolor=%s;content_offset=0;sound=i3_tab]", fs(fmt("style_type[image_button;noclip=true;font_size=16;textcolor=%s;content_offset=0;sound=i3_tab]",
selected and "#fff" or "#ddd")) selected and "#fff" or "#ddd"))
@ -1480,20 +1475,15 @@ local function get_tabs_fs(fs, player, data, full_height)
end end
local selected = i == data.tab local selected = i == data.tab
local legacy_fs = data.fs_version < 6
local bgimg = selected and (btm and PNG.tab_hover or PNG.tab_hover_top) or local bgimg = selected and (btm and PNG.tab_hover or PNG.tab_hover_top) or
(btm and PNG.tab or PNG.tab_top) (btm and PNG.tab or PNG.tab_top)
local bgimg_hover = btm and PNG.tab_hover or PNG.tab_hover_top local bgimg_hover = btm and PNG.tab_hover or PNG.tab_hover_top
if legacy_fs then
fs(fmt("style_type[image_button;fgimg=%s;fgimg_hovered=%s]", bgimg, bgimg_hover))
else
local middle = btm and "16,0,-16,-16" or "16,0,-16,0" local middle = btm and "16,0,-16,-16" or "16,0,-16,0"
local padding = btm and "-16,0,16,16" or "-16,-16,16,16" local padding = btm and "-16,0,16,16" or "-16,-16,16,16"
fs(fmt([[style_type[image_button;bgimg=%s;bgimg_hovered=%s;bgimg_middle=%s;padding=%s] ]], fs(fmt([[style_type[image_button;bgimg=%s;bgimg_hovered=%s;bgimg_middle=%s;padding=%s] ]],
bgimg, bgimg_hover, middle, padding)) bgimg, bgimg_hover, middle, padding))
end
fs(fmt("style_type[image_button;noclip=true;font_size=16;textcolor=%s;content_offset=0;sound=i3_tab]", fs(fmt("style_type[image_button;noclip=true;font_size=16;textcolor=%s;content_offset=0;sound=i3_tab]",
selected and "#fff" or "#ddd")) selected and "#fff" or "#ddd"))