diff --git a/html/js/input/inputHandler.js b/html/js/input/inputHandler.js index fccbca5..6826dca 100644 --- a/html/js/input/inputHandler.js +++ b/html/js/input/inputHandler.js @@ -201,20 +201,22 @@ const InputHandler = { setupClickHandlers: function() { // Add click handling for the HTML START button $('#startButton').click(function(e) { - // If early entry is available and user has credits, show choice modal + // Show the wait-vs-drop-in TIMING choice whenever the game would start instantly (no + // upfront payment): free play (this instance allows it), a FREE instance, or paid-credits + // with credits in hand. The chosen payment method flows through auto_start / join_queue + // unchanged — this modal only picks WHEN you enter. if (typeof SocketHandlers !== 'undefined') { - var isPaidCredits = SocketHandlers._gameMode === 'PAID_CREDITS'; + var mode = SocketHandlers._gameMode; + var freeAvailable = SocketHandlers._freePlayEnabled || mode === 'FREE'; var hasCredits = SocketHandlers._creditsBalance >= (SocketHandlers._creditsPerGame || 1); - var earlyAllowed = SocketHandlers._earlyEntryConfig && - SocketHandlers._earlyEntryConfig.enabled && - SocketHandlers._earlyEntryConfig.allowInCreditsMode; - if (isPaidCredits && hasCredits && earlyAllowed) { - SocketHandlers.showEntryChoiceModal(); + var instantStart = freeAvailable || (mode === 'PAID_CREDITS' && hasCredits); + if (instantStart) { + SocketHandlers.showEntryChoiceModal({ freeAvailable: freeAvailable, hasCredits: hasCredits }); return; } } - // Default: attempt immediate start + // Default: attempt immediate start (payment-required modes go through their own flow) socket.emit('auto_start'); // Check if we should show waiting screen diff --git a/html/js/network/socketHandlers.js b/html/js/network/socketHandlers.js index 9fd5623..332e200 100644 --- a/html/js/network/socketHandlers.js +++ b/html/js/network/socketHandlers.js @@ -708,6 +708,7 @@ const SocketHandlers = { // Store game mode and early entry config SocketHandlers._gameMode = data.mode; + SocketHandlers._freePlayEnabled = !!data.freePlayEnabled; SocketHandlers._earlyEntryConfig = data.earlyEntry || { enabled: false }; SocketHandlers._creditsPayoutsEnabled = !!data.creditsPayoutsEnabled; SocketHandlers._directPayoutsEnabled = !!data.directPayoutsEnabled; @@ -1693,11 +1694,15 @@ const SocketHandlers = { // Entry Choice Modal // ===================== - showEntryChoiceModal: function() { + showEntryChoiceModal: function(opts) { + opts = opts || {}; // Remove any existing modal $('#entryChoiceOverlay').remove(); var cost = this._creditsPerGame || 1; + var costText = opts.freeAvailable + ? 'Free play — no credits needed' + : ('Cost: ' + cost + ' credit per game'); var $overlay = $('