From ae4661a3b138cd80a3c4406caf7e45bd0d7d31b0 Mon Sep 17 00:00:00 2001 From: 12problems Date: Sat, 5 Sep 2026 23:58:01 -0400 Subject: [PATCH] Add a hover tooltip explaining why Ranked is greyed out The Find Game menu's Ranked section already greys itself out via SPDRN._ranked_queue_available() (MPAPI.is_launcher_verified()), but gives the player no indication why -- a legitimate player who isn't using the launcher (or hasn't verified yet) just sees a disabled section with no explanation. Attach a hover tooltip to the section's own container (not the individual buttons, since a disabled button's hover collision is stripped and would never fire it) explaining that Ranked mode needs to be launched through the launcher. This is a plain on-hover tooltip, not an unsolicited popup, so it doesn't reintroduce the "misleading noise on every normal launch" problem af85092 removed on MultiplayerAPI -- it only shows if the player actually hovers the greyed-out section. --- localization/en-us.lua | 6 ++++++ ui/main_menu/find_game.lua | 20 +++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/localization/en-us.lua b/localization/en-us.lua index 3caf578..ba7c155 100644 --- a/localization/en-us.lua +++ b/localization/en-us.lua @@ -26,6 +26,12 @@ return { k_stat_best_run_time = 'Best Run Time', k_stat_times_skipped = 'Times Skipped', k_stat_best_hand = 'Best Hand', + -- Hover tooltip on the Find Game menu's Ranked section while it's greyed + -- out (ui/main_menu/find_game.lua's queue_section) -- SPDRN._ranked_queue_available() + -- is a bare boolean (MPAPI.is_launcher_verified()), so this covers every + -- reason it can be false (no BET, Casual launch, or verification still + -- pending) with one honest, generic explanation rather than guessing which. + k_ranked_launcher_required_cap = "Launch the game via the launcher's Ranked mode to queue for Ranked", }, }, } diff --git a/ui/main_menu/find_game.lua b/ui/main_menu/find_game.lua index 624cddc..1f9dae4 100644 --- a/ui/main_menu/find_game.lua +++ b/ui/main_menu/find_game.lua @@ -83,16 +83,30 @@ end -- white_gm/gold_gm are the exact game_mode strings the server's queue-counts response -- uses (i.e. already carrying the "ranked:" prefix for a ranked section) -- see -- objects/matchmaking/queue.lua's own game_mode construction, which this must match. -local function queue_section(label, white_gm, white_btn, gold_gm, gold_btn, enabled) +-- +-- `disabled_reason`, when set, attaches a hover tooltip explaining why to the section's +-- own container rather than to the individual buttons: build_stat_button sets +-- `hover = enabled`, so a disabled button never collides with the cursor and a tooltip +-- on it would never fire. The outer column keeps its own hover collision regardless of +-- button state, so the reason is still reachable by hovering the greyed-out section. +local function queue_section(label, white_gm, white_btn, gold_gm, gold_btn, enabled, disabled_reason) local white_el = MPAPI.ui_element(function() return { nodes = { build_stat_button(white_btn, { 'White Stake', 'Triple' }, white_gm, G.C.ETERNAL, enabled) } } end) local gold_el = MPAPI.ui_element(function() return { nodes = { build_stat_button(gold_btn, { 'Gold Stake', 'Single' }, gold_gm, G.C.GOLD, enabled) } } end) _count_els[white_gm] = white_el _count_els[gold_gm] = gold_el + local show_tooltip = not enabled and disabled_reason ~= nil return { n = G.UIT.C, - config = { align = 'cm', padding = 0.1, r = 0.2, colour = G.C.BLACK }, + config = { + align = 'cm', + padding = 0.1, + r = 0.2, + colour = G.C.BLACK, + hover = show_tooltip, + tooltip = show_tooltip and { text = { disabled_reason } } or nil, + }, nodes = { { n = G.UIT.R, config = { align = 'cm', padding = 0.05 }, nodes = { white_el.node, @@ -140,7 +154,7 @@ G.FUNCS.spdrn_find_game = function() config = { align = 'cm', padding = 0.1 }, nodes = { { n = G.UIT.C, config = { align = 'cm', padding = 0.1 }, nodes = { - queue_section(localize('k_ranked_cap'), SPDRN.LobbyKind.RANKED_PREFIX .. SPDRN.Gamemode.WHITE_STAKE_TRIPLE, 'spdrn_queue_ranked_white', SPDRN.LobbyKind.RANKED_PREFIX .. SPDRN.Gamemode.GOLD_STAKE_SINGLE, 'spdrn_queue_ranked_gold', SPDRN._ranked_queue_available()), + queue_section(localize('k_ranked_cap'), SPDRN.LobbyKind.RANKED_PREFIX .. SPDRN.Gamemode.WHITE_STAKE_TRIPLE, 'spdrn_queue_ranked_white', SPDRN.LobbyKind.RANKED_PREFIX .. SPDRN.Gamemode.GOLD_STAKE_SINGLE, 'spdrn_queue_ranked_gold', SPDRN._ranked_queue_available(), localize('k_ranked_launcher_required_cap')), } }, { n = G.UIT.C, config = { align = 'cm', padding = 0.1 }, nodes = { queue_section(localize('k_casual_cap'), SPDRN.Gamemode.WHITE_STAKE_TRIPLE, 'spdrn_queue_casual_white', SPDRN.Gamemode.GOLD_STAKE_SINGLE, 'spdrn_queue_casual_gold', true),