Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Swarsel opened this issue Apr 28, 2020 · 2 comments
Open

Comments

@Swarsel
Copy link

Swarsel commented Apr 28, 2020

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
Copy link
Author

Swarsel commented Apr 29, 2020

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 :)

@Swarsel Swarsel changed the title Builder Lens is shown twice in MoreLenses submenu Builder Lens is shown twice in MoreLenses submenu - including solution Apr 29, 2020
@Swarsel Swarsel changed the title Builder Lens is shown twice in MoreLenses submenu - including solution Builder Lens appears twice in MoreLenses submenu - including solution Apr 29, 2020
@the-m4a
Copy link
Contributor

the-m4a commented May 29, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants