<commit_before>if _mpPatch and _mpPatch.loaded then
    Modding = _mpPatch.hookTable(Modding, {ActivateAllowedDLC = function(...)
        _mpPatch.overrideModsFromPreGame()
        return Modding._super.ActivateAllowedDLC(...)
    end})

    local function enterLobby()
        UIManager:QueuePopup(Controls.StagingRoomScreen, PopupPriority.StagingScreen)
        UIManager:DequeuePopup(ContextPtr)
    end
    local function joinFailed(message)
        Events.FrontEndPopup.CallImmediate(message)
        g_joinFailed = true
        Matchmaking.LeaveMultiplayerGame()
        UIManager:DequeuePopup(ContextPtr)
    end
    function OnConnectionCompete()
        if not Matchmaking.IsHost() then
            if _mpPatch.isModding then
                local missingModList = {}
                _mpPatch.debugPrint("Enabled mods for room:")
                for _, mod in ipairs(_mpPatch.decodeModsList()) do
                    local missingText = ""
                    if not Modding.IsModInstalled(mod.ID, mod.Version) then
                        table.insert(missingModList, mod.Name)
                        missingText = " (is missing)"
                    end
                    _mpPatch.debugPrint("- "..mod.Name..missingText)
                end
                -- TODO: Check for DLCs/mod compatibility
                if #missingModList > 0 then
                    local messageTable = {Locale.Lookup("TXT_KEY_MPPATCH_MOD_MISSING")}
                    for _, name in ipairs(missingModList) do
                        table.insert(messageTable, "[ICON_BULLET]"..v.Name:gsub("%[", "("):gsub("%]", ")"))
                    end
                    joinFailed(table.concat(messageTable, "[NEWLINE]"))
                    return
                end

                _mpPatch.debugPrint("Activating mods and DLC...")
                Modding.ActivateAllowedDLC()
            end

            enterLobby()
        end
    end
end<commit_msg>Fix more joiningroom issues.<commit_after>if _mpPatch and _mpPatch.loaded then
    Modding = _mpPatch.hookTable(Modding, {ActivateAllowedDLC = function(...)
        _mpPatch.overrideModsFromPreGame()
        return Modding._super.ActivateAllowedDLC(...)
    end})

    local function enterLobby()
        UIManager:QueuePopup(Controls.StagingRoomScreen, PopupPriority.StagingScreen)
        UIManager:DequeuePopup(ContextPtr)
    end
    local function joinFailed(message)
        Events.FrontEndPopup.CallImmediate(message)
        g_joinFailed = true
        Matchmaking.LeaveMultiplayerGame()
        UIManager:DequeuePopup(ContextPtr)
    end
    function OnConnectionCompete()
        if not Matchmaking.IsHost() then
            if _mpPatch.isModding then
                local missingModList = {}
                _mpPatch.debugPrint("Enabled mods for room:")
                for _, mod in ipairs(_mpPatch.decodeModsList()) do
                    local missingText = ""
                    if not Modding.IsModInstalled(mod.ID, mod.Version) then
                        table.insert(missingModList, mod.Name)
                        missingText = " (is missing)"
                    end
                    _mpPatch.debugPrint("==DEBUG==", mod.ID, mod.Version, mod.Name)
                    _mpPatch.debugPrint("- "..mod.Name..missingText)
                end
                -- TODO: Check for DLCs/mod compatibility
                if #missingModList > 0 then
                    local messageTable = {Locale.Lookup("TXT_KEY_MPPATCH_MOD_MISSING")}
                    for _, name in ipairs(missingModList) do
                        table.insert(messageTable, "[ICON_BULLET]"..name:gsub("%[", "("):gsub("%]", ")"))
                    end
                    joinFailed(table.concat(messageTable, "[NEWLINE]"))
                    return
                end

                _mpPatch.debugPrint("Activating mods and DLC...")
                Modding.ActivateAllowedDLC()
            end

            enterLobby()
        end
    end
end
{'fraction_non_alphanumeric': 0.09150162948107295, 'fraction_numerical': 0.000501378791677112, 'mean_word_length': 1.7593360995850622, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4255139', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1047, 'n_words': 206}