From a3fea93a09d14d2406297e3c9d391de682fd8ecb Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Mon, 1 Aug 2022 03:57:32 +0200 Subject: [PATCH] Remove all the legacy code (MT 5.6+ required) --- init.lua | 2 +- src/gui.lua | 26 ++++++++------------------ 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/init.lua b/init.lua index d31a80f..f4aaa19 100644 --- a/init.lua +++ b/init.lua @@ -27,7 +27,7 @@ i3 = { debug_mode = false, max_favs = 6, max_waypoints = 30, - min_fs_version = 4, + min_fs_version = 6, item_btn_size = 1.1, drop_bag_on_die = true, save_interval = 600, -- Player data save interval (in seconds) diff --git a/src/gui.lua b/src/gui.lua index 426acde..9320866 100644 --- a/src/gui.lua +++ b/src/gui.lua @@ -670,7 +670,7 @@ local function get_inventory_fs(player, data, fs) --fs("style[player_model;bgcolor=black]") model(0.2, 0.2, armor_skin and 4 or 3.4, ctn_hgt, "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 local size = 2.5 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]" label(data.inv_width + 0.9, 0.49, clr("#aaa", ES"Search...")) 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 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 tab_len, tab_hgh = 1.8, 0.5 - local legacy_fs = data.fs_version < 6 for i, title in ipairs(_tabs) do local selected = i == data.itab 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; - bgimg_middle=14,0,-14,-14;padding=-14,0,14,14] ]], hover_texture, PNG.tab_small_hover)) - end + 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)) fs(fmt("style_type[image_button;noclip=true;font_size=16;textcolor=%s;content_offset=0;sound=i3_tab]", selected and "#fff" or "#ddd")) @@ -1480,20 +1475,15 @@ local function get_tabs_fs(fs, player, data, full_height) end 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 (btm and PNG.tab or PNG.tab_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 padding = btm and "-16,0,16,16" or "-16,-16,16,16" + 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" - fs(fmt([[style_type[image_button;bgimg=%s;bgimg_hovered=%s;bgimg_middle=%s;padding=%s] ]], - bgimg, bgimg_hover, middle, padding)) - end + fs(fmt([[style_type[image_button;bgimg=%s;bgimg_hovered=%s;bgimg_middle=%s;padding=%s] ]], + bgimg, bgimg_hover, middle, padding)) fs(fmt("style_type[image_button;noclip=true;font_size=16;textcolor=%s;content_offset=0;sound=i3_tab]", selected and "#fff" or "#ddd"))