Skip to content

Commit

Permalink
Use a different method to determine if we're indoors or not.
Browse files Browse the repository at this point in the history
Progress towards #61. No side-effects detected yet, but at least we're no longer launching ourselves into an exponentially increasing infinite loop.
  • Loading branch information
Ravendwyr committed Jan 3, 2021
1 parent eb08055 commit a0d5ee6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 10 additions & 8 deletions Modules/Appearance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ function Appearance:OnEnable()
v:Show()
end

self:RegisterEvent("MINIMAP_UPDATE_ZOOM")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("ADDON_LOADED")
self:RegisterEvent("CVAR_UPDATE")
self:RegisterEvent("ZONE_CHANGED_INDOORS")
self:RegisterEvent("ZONE_CHANGED")

-- Removes the circular "waffle-like" texture that shows when using a non-circular minimap in the blue quest objective area.
-- Thank you Funkeh` for the code!
Expand Down Expand Up @@ -142,15 +143,16 @@ function Appearance:CVAR_UPDATE(_, key, value)
if key == "ROTATE_MINIMAP" then rotateMinimap = value end
end

function Appearance:MINIMAP_UPDATE_ZOOM()
local zoom = Minimap:GetZoom()

if GetCVar("minimapZoom") == GetCVar("minimapInsideZoom") then
Minimap:SetZoom(zoom < 2 and zoom + 1 or zoom - 1)
end
function Appearance:ZONE_CHANGED_INDOORS()
indoors = true

if inCombat then self:SetCombatAlpha()
else self:SetAlpha() end
end

indoors = GetCVar("minimapZoom")+0 ~= Minimap:GetZoom()
Minimap:SetZoom(zoom)
function Appearance:ZONE_CHANGED()
indoors = false

if inCombat then self:SetCombatAlpha()
else self:SetAlpha() end
Expand Down
18 changes: 8 additions & 10 deletions Modules/RangeCircle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ function RangeCircle:OnEnable()

texture:Show()

self:RegisterEvent("MINIMAP_UPDATE_ZOOM")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("ZONE_CHANGED_INDOORS")
self:RegisterEvent("ZONE_CHANGED")
self:Update()

self:SecureHook(Minimap, "SetZoom", "Update")
Expand All @@ -88,16 +89,13 @@ function RangeCircle:PLAYER_REGEN_DISABLED()
self:Update()
end

function RangeCircle:MINIMAP_UPDATE_ZOOM()
local zoom = Minimap:GetZoom()

if GetCVar("minimapZoom") == GetCVar("minimapInsideZoom") then
Minimap:SetZoom(zoom < 2 and zoom + 1 or zoom - 1)
end

indoors = GetCVar("minimapZoom")+0 ~= Minimap:GetZoom()
Minimap:SetZoom(zoom)
function RangeCircle:ZONE_CHANGED_INDOORS()
indoors = true
self:Update()
end

function RangeCircle:ZONE_CHANGED()
indoors = false
self:Update()
end

Expand Down

0 comments on commit a0d5ee6

Please sign in to comment.