Combuctor (native Bagnon)

Combuctor (native Bagnon)

2M Downloads

Bag will not autoclose in combat engagement. I am unable to close the addon in combat with the X button either.

Coffeechan opened this issue · 3 comments

commented

Running Software (issues missing this information will be deleted):

  • Addon version: 2.5.1
  • Server patch: [e.g. Build 8.0.1.27178]

Have you read the changelog? (please don't waste our time)
Mark if read.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behaviour
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Error Logs
Type /console scriptErrors 1 in the chat and reload the game. If an error window appears, write here the message with ID: 1 (labelled 1/X). This is generally NOT the message that the window shows by default.

Additional context
Add any other context about the problem here.

commented

I know the problem is because HideUIPanel() is protected and cannot be called during combat.

Patch 8.2.0/API changes

  • ShowUIPanel() and HideUIPanel() are now protected, they can no longer be called by addons while in combat.

I couldn't find a normal solution because I can't find how HideUIPanel() is triggered. But I found a workaround with it. Add this code to any Lua file and the problem will disappear:

hooksecurefunc("HideUIPanel", function(ui)
    if InCombatLockdown() and type(ui) == 'table' and ui.bagToggle then
        ui:Hide()
    end
end)

It will use the ui:Hide() method to close the bag in battle, which is not affected by the combat lockdown.

commented
commented

I know the problem is because HideUIPanel() is protected and cannot be called during combat.

Patch 8.2.0/API changes

  • ShowUIPanel() and HideUIPanel() are now protected, they can no longer be called by addons while in combat.

I couldn't find a normal solution because I can't find how HideUIPanel() is triggered. But I found a workaround with it. Add this code to any Lua file and the problem will disappear:

hooksecurefunc("HideUIPanel", function(ui)
    if InCombatLockdown() and type(ui) == 'table' and ui.bagToggle then
        ui:Hide()
    end
end)

It will use the ui:Hide() method to close the bag in battle, which is not affected by the combat lockdown.

Could you explain what "Add this code to any Lua file and the problem will disappear:" means?
Just add id to "every" of the 20+ LUA files?
Just add it to the end of every LUA file?

Sorry I don't know a thing about grogramming.