From b242973993fe84274c6cf354b6e245b8a9f58fb0 Mon Sep 17 00:00:00 2001 From: makatymba2001 Date: Sat, 6 Jun 2026 02:06:39 +0300 Subject: [PATCH 1/2] prettify lobby info --- ui/game/lobby_info.lua | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ui/game/lobby_info.lua b/ui/game/lobby_info.lua index 62a6fac1..47c6f977 100644 --- a/ui/game/lobby_info.lua +++ b/ui/game/lobby_info.lua @@ -180,26 +180,29 @@ function MP.UI.create_UIBox_player_row(type) nodes = { { n = G.UIT.C, - config = { align = "cm", padding = 0.05, r = 0.1, colour = G.C.BLACK }, + config = { align = "cm" }, nodes = { { n = G.UIT.C, config = { align = "cm", - padding = 0.025, + padding = 0.05, r = 0.1, colour = G.C.MULT, minw = 2, + maxw = 2, outline = 0.5, outline_colour = G.C.MULT, + emboss = 0.07, }, nodes = { { n = G.UIT.T, config = { text = tostring(lives) .. " " .. localize("k_lives"), - scale = 0.4, + scale = 0.375, colour = G.C.UI.TEXT_LIGHT, + shadow = true, }, }, }, @@ -229,26 +232,29 @@ function MP.UI.create_UIBox_player_row(type) }, { n = G.UIT.C, - config = { align = "cm", padding = 0.05, colour = G.C.BLACK, r = 0.1 }, + config = { align = "cm" }, nodes = { { n = G.UIT.C, config = { align = "cm", - padding = 0.025, + padding = 0.05, r = 0.1, colour = G.C.PURPLE, minw = 1.75, + maxw = 1.75, outline = 0.5, outline_colour = G.C.PURPLE, + emboss = 0.07, }, nodes = { { n = G.UIT.T, config = { text = tostring(skips) .. " " .. localize("k_skips"), - scale = 0.4, + scale = 0.375, colour = G.C.UI.TEXT_LIGHT, + shadow = true, }, }, }, @@ -294,7 +300,7 @@ function MP.UI.create_UIBox_player_row(type) n = G.UIT.T, config = { text = MP.INSANE_INT.to_string(highest_score), - scale = 0.45, + scale = 0.425, colour = G.C.FILTER, shadow = true, }, From 04545528da10422f90c59f19227c0c18ae635233 Mon Sep 17 00:00:00 2001 From: makatymba2001 Date: Sat, 6 Jun 2026 03:10:04 +0300 Subject: [PATCH 2/2] prettify players mod list --- lib/matchmaking.lua | 8 +++++ lib/string_utils.lua | 4 +++ ui/lobby/lobby.lua | 71 +++++++++++++++++++++++++++++++++++++++----- 3 files changed, 75 insertions(+), 8 deletions(-) diff --git a/lib/matchmaking.lua b/lib/matchmaking.lua index 4d73999b..28100c33 100644 --- a/lib/matchmaking.lua +++ b/lib/matchmaking.lua @@ -178,6 +178,14 @@ function MP.UTILS.parse_modlist(mod_entries) return mods end +function MP.UTILS.resolve_mod_name_and_version(mod_name, mod_version) + local fullname = mod_name .. "-" .. (mod_version or "") + local new_mod_name, new_mod_version = fullname:match("^(.*)%-([^~]+~.*)$") + mod_name = new_mod_name or mod_name + mod_version = new_mod_version or mod_version + return mod_name, mod_version +end + -- "0.4.0~pre1-DEV" -> "0.4.0". nil if no leading numeric version. function MP.UTILS.version_prefix(version) if type(version) ~= "string" then return nil end diff --git a/lib/string_utils.lua b/lib/string_utils.lua index c44a81e5..0f41d324 100644 --- a/lib/string_utils.lua +++ b/lib/string_utils.lua @@ -24,3 +24,7 @@ function MP.UTILS.string_split(inputstr, sep) end return t end + +function MP.UTILS.string_starts(str, prefix) + return str:sub(1, #prefix) == prefix +end \ No newline at end of file diff --git a/ui/lobby/lobby.lua b/ui/lobby/lobby.lua index 5d08ab8b..af86e090 100644 --- a/ui/lobby/lobby.lua +++ b/ui/lobby/lobby.lua @@ -204,30 +204,85 @@ end function MP.UI.modlist_to_view(mods, text_colour) local t = {} - if not mods then return t end + if not mods then + return t + end + local special_mods_targets = { + "Steamodded", + "Lovely", + "Multiplayer", + "Preview", + } + local special_mods_found = {} + local other_mods = {} for mod_name, mod_version in pairs(mods) do - local display_text = mod_version and (mod_name .. "-" .. mod_version) or mod_name - local color = MP.BANNED_MODS[mod_name] and G.C.RED or text_colour + local found = false + for _, id in ipairs(special_mods_targets) do + if not special_mods_found[id] and MP.UTILS.string_starts(mod_name, id) then + special_mods_found[id] = { name = mod_name, version = mod_version } + found = true + break + end + end + if not found then + table.insert(other_mods, { name = mod_name, version = mod_version }) + end + end + + table.sort(other_mods, function(a, b) + return a.name < b.name + end) + + local function add_mod_row(mod) + local mod_name, mod_version = MP.UTILS.resolve_mod_name_and_version(mod.name, mod.version) + local color = MP.BANNED_MODS[mod.name] and G.C.RED or text_colour table.insert(t, { n = G.UIT.R, config = { - padding = 0.02, - align = "cm", + padding = 0.025, }, nodes = { { n = G.UIT.T, config = { - text = display_text, - shadow = true, - scale = 0.4, + text = mod_name, + scale = 0.32, colour = color, }, }, + mod_version and { + n = G.UIT.T, + config = { + text = " " .. mod_version, + scale = 0.32, + colour = adjust_alpha(color, 0.6), + }, + } or nil, }, }) end + local function add_separator() + table.insert(t, { + n = G.UIT.R, + config = { + minh = 0.025, + colour = adjust_alpha(text_colour, 0.25), + }, + }) + end + + for _, mod in pairs({ special_mods_found.Lovely, special_mods_found.Steamodded }) do + add_mod_row(mod) + end + add_separator() + for _, mod in pairs({ special_mods_found.Multiplayer, special_mods_found.Preview }) do + add_mod_row(mod) + end + add_separator() + for _, mod in ipairs(other_mods) do + add_mod_row(mod) + end return t end