From dd17b6ce1779069c1c757cdebafe339c0622674c Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sun, 15 Jun 2025 15:28:18 +0200 Subject: [PATCH] Fix deprecated field 'hud_elem_type' and limit line length --- .luacheckrc | 5 +++-- internal.lua | 9 ++++++--- waypoints.lua | 5 +++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index a951e48..cf2deed 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -1,6 +1,6 @@ unused_args = false allow_defined_top = true -max_line_length = 999 +max_line_length = 131 globals = { "unified_inventory", @@ -11,8 +11,9 @@ read_globals = { table = {fields = {"copy", "getn"}}, "dump", - "minetest", "vector", + "core", "minetest", "ItemStack", "datastorage", + "vector", "hb", "doors", diff --git a/internal.lua b/internal.lua index 3caa43a..34e981e 100644 --- a/internal.lua +++ b/internal.lua @@ -143,18 +143,21 @@ local function formspec_add_categories(player, formspec, ui_peruser) if ui.current_category[player_name] == category.name then scale = 1 end - formspec[n] = formspec_button(ui_peruser, "category_"..category.name, category.symbol, categories_pos, {column-1, 0}, scale, category.label) + formspec[n] = formspec_button(ui_peruser, "category_"..category.name, category.symbol, categories_pos, + {column-1, 0}, scale, category.label) n = n + 1 end end if category_count > ui_peruser.pagecols and scroll_offset > 0 then -- prev - formspec[n] = formspec_button(ui_peruser, "prev_category", "ui_left_icon.png", categories_scroll_pos, {ui_peruser.pagecols - 2, 0}, 0.8, S("Scroll categories left")) + formspec[n] = formspec_button(ui_peruser, "prev_category", "ui_left_icon.png", categories_scroll_pos, + {ui_peruser.pagecols - 2, 0}, 0.8, S("Scroll categories left")) n = n + 1 end if category_count > ui_peruser.pagecols and category_count - scroll_offset > ui_peruser.pagecols then -- next - formspec[n] = formspec_button(ui_peruser, "next_category", "ui_right_icon.png", categories_scroll_pos, {ui_peruser.pagecols - 1, 0}, 0.8, S("Scroll categories right")) + formspec[n] = formspec_button(ui_peruser, "next_category", "ui_right_icon.png", categories_scroll_pos, + {ui_peruser.pagecols - 1, 0}, 0.8, S("Scroll categories right")) end end diff --git a/waypoints.lua b/waypoints.lua index 8fdd801..14c112e 100644 --- a/waypoints.lua +++ b/waypoints.lua @@ -164,7 +164,8 @@ ui.register_page("waypoints", { }, { "toggle_display_pos", - waypoint.display_pos and "ui_green_icon_background.png^ui_xyz_icon.png" or "ui_red_icon_background.png^ui_xyz_icon.png^(ui_no.png^[transformR90)", + waypoint.display_pos and "ui_green_icon_background.png^ui_xyz_icon.png" or + "ui_red_icon_background.png^ui_xyz_icon.png^(ui_no.png^[transformR90)", waypoint.display_pos and S("Hide coordinates") or S("Show coordinates") }, { @@ -254,7 +255,7 @@ local function update_hud(player, waypoints, temp, i) end if waypoint.active then temp.hud = player:hud_add({ - hud_elem_type = "waypoint", + [core.features.hud_def_type_field and "type" or "hud_elem_type"] = "waypoint", number = hud_colors[waypoint.color or 1][2] , name = name, text = "m",