Azurency / CQUI_Community-Edition

Civilization 6 mod - UI enhancements, reduce clicks and manage your empire faster!
MIT License
399 stars 98 forks source link

Builder Lens appears twice in MoreLenses submenu - including solution #416

Open Swarsel opened 4 years ago

Swarsel commented 4 years ago

Environment: No other mods, only newest release of CQUI from one month ago. Cache etc. cleared

In the submenu of MoreLenses (with many radio buttons that toggle the lenses), two times "Builder" can be seen. One is working properly, the other one takes the state of the last lens used, e.g. if "Naturalist" lens was used last before clicking said bugged lens, it will behave like "Naturalist" lens as well.

I looked at the files for MoreLens integration, will take some time. Maybe it needs to be this way because of the way it is integrated? Either way, simply hiding the erroneous option should do the trick.

Greets

PS: futuremodders. txt states: "ML/UI/MinimapPanel.lua requires special attention when updating, due to custom hooks into the CQUI mod options"

What is this special attention? Is MoreLenses on version 4-2-3 in CQUI? If no, could you tell me what this special attention includes? I could update it.

Swarsel commented 4 years ago

I have found a makeshift solution for the problem above; in function InitLens(lensName, modLens) of minimappanel.lua, I added the line of if lensName ~= "CQUI_CITIZEN_MANAGEMENT" then

The complete function thus became:

function InitLens(lensName, modLens)
  print("Adding ModLens: " .. lensName)
  if modLens.Initialize ~= nil then
    modLens.Initialize()
  end

  -- Add this lens to button stack

  if lensName ~= "CQUI_CITIZEN_MANAGEMENT" then
    local modLensToggle = m_LensButtonIM:GetInstance();
    local pLensButton = modLensToggle.LensButton:GetTextButton()
    local pToolTip = Locale.Lookup(modLens.LensButtonTooltip)
    pLensButton:LocalizeAndSetText(modLens.LensButtonText)
    modLensToggle.LensButton:SetToolTipString(pToolTip)
    modLensToggle.LensButton:RegisterCallback(Mouse.eLClick,
    function()
        ToggleModLens(modLensToggle.LensButton, lensName);
    end
  )
  end
end

Not the most elegant solution, but I could think of no other way without breaking the given functionality. From my testing, this seems to keep everything working as it should, while removing the nasty entry in the LensList.

I also updated MoreLenses to the most recent version of 4-2-3; so far, everything seems to be working. I mostly copied around missing lines from one version to the other. In the attachment I have included the whole /integrations/ML that I have created, in case it helps others or can be included in the official version :) however, more testing is possibly needed. ML.zip

Greets :)

the-m4a commented 4 years ago

thanks for this - I'll include it in a fix tonight edit: in the CQUI - it's using the current ML, but added this fix, based on your recommendation. So far it seems to work.