Skip to content

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydude committed Nov 23, 2020
1 parent 6b6e42b commit 754b371
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions SexyMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ mod.deepCopyHash = function(t)
end
return nt
end
mod.frame:SetScript("OnEvent", function(_, event, ...)
mod[event](sm, ...)
end)

mod.options = {
type = "group",
Expand Down Expand Up @@ -311,6 +314,8 @@ mod.options = {

function mod:ADDON_LOADED(addon)
if addon == "SexyMap" then
mod.frame:UnregisterEvent("ADDON_LOADED")

if type(SexyMap2DB) ~= "table" then
SexyMap2DB = {}
end
Expand Down Expand Up @@ -380,14 +385,14 @@ function mod:ADDON_LOADED(addon)
end
end

mod.frame:UnregisterEvent("ADDON_LOADED")
mod.frame:RegisterEvent("PLAYER_LOGIN")
mod.frame:RegisterEvent("LOADING_SCREEN_DISABLED")
mod.ADDON_LOADED = nil
end
end
mod.frame:RegisterEvent("ADDON_LOADED")

function mod:PLAYER_LOGIN()
mod.frame:UnregisterEvent("PLAYER_LOGIN")

-- Setup config
LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable(name, mod.options, true)
LibStub("AceConfigDialog-3.0"):AddToBlizOptions(name)
Expand Down Expand Up @@ -418,12 +423,14 @@ function mod:PLAYER_LOGIN()
sm[mod.loadModules[i]].OnEnable = nil
end

mod.frame:UnregisterEvent("PLAYER_LOGIN")
mod.PLAYER_LOGIN = nil
end
mod.frame:RegisterEvent("PLAYER_LOGIN")

-- Hopefully temporary workaround for string size functions returning 0 for foreign fonts at PLAYER_LOGIN on a cold boot
function mod:LOADING_SCREEN_DISABLED()
mod.frame:UnregisterEvent("LOADING_SCREEN_DISABLED")

for i=1, #mod.loadModules do
local module = sm[mod.loadModules[i]]
if module and module.OnLoadingScreenOver then
Expand All @@ -433,9 +440,9 @@ function mod:LOADING_SCREEN_DISABLED()
end
mod.loadModules = nil

mod.frame:UnregisterEvent("LOADING_SCREEN_DISABLED")
mod.LOADING_SCREEN_DISABLED = nil
end
mod.frame:RegisterEvent("LOADING_SCREEN_DISABLED")

if mod.frame.GetFrameStrata(Minimap) ~= "LOW" then
mod.frame.SetFrameStrata(Minimap, "LOW") -- Blizz Defaults patch 9.0.1 Minimap.xml
Expand Down Expand Up @@ -552,11 +559,6 @@ function mod:SetupMap()
self.SetupMap = nil
end

mod.frame:RegisterEvent("ADDON_LOADED")
mod.frame:SetScript("OnEvent", function(_, event, ...)
mod[event](sm, ...)
end)

function mod:RegisterModuleOptions(modName, optionTbl, displayName)
LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable(name..modName, optionTbl, true)
LibStub("AceConfigDialog-3.0"):AddToBlizOptions(name..modName, displayName, name)
Expand Down

0 comments on commit 754b371

Please sign in to comment.