Skip to content

Commit

Permalink
Adjust the addon startup logic, should fix #117
Browse files Browse the repository at this point in the history
  • Loading branch information
Numynum committed Mar 3, 2024
1 parent 0029a3f commit 38e4cb6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
34 changes: 15 additions & 19 deletions BlizzMove.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ local CreateFrame = _G.CreateFrame;
local abs = _G.abs;

local name = ... or "BlizzMove";
--- @class BlizzMove
--- @class BlizzMove: AceAddon,AceConsole-3.0,AceEvent-3.0,AceHook-3.0
local BlizzMove = LibStub("AceAddon-3.0"):NewAddon(name, "AceConsole-3.0", "AceEvent-3.0", "AceHook-3.0");
if not BlizzMove then return; end

Expand Down Expand Up @@ -143,7 +143,7 @@ do
if (
not self:IsFrameDisabled(addOnName, frameName)
and IsAddOnLoaded(addOnName)
and (addOnName ~= self.name and self.enabled or self.initialized)
and self.initialized
) then
self:ProcessFrame(addOnName, frameName, copiedData);
end
Expand Down Expand Up @@ -1177,8 +1177,19 @@ do
for _, command in pairs(commands) do
self:RegisterChatCommand('bm'..command, function(message) self:OnSlashCommand(command..' '..message); end);
end
self:ProcessFrames(self.name);
self:SecureHook('UpdateScaleForFit', OnUpdateScaleForFit);

self:SavePositionStrategyChanged(nil, self.DB.savePosStrategy);
C_CVar.SetCVar('enableSourceLocationLookup', 1)

self:ADDON_LOADED(_, self.name);
for addOnName, _ in pairs(self.Frames) do
if addOnName ~= self.name and IsAddOnLoaded(addOnName) then
self:ADDON_LOADED(_, addOnName);
end
end

self:RegisterEvent("ADDON_LOADED");
end

function BlizzMove:OnSlashCommand(message)
Expand Down Expand Up @@ -1256,7 +1267,7 @@ do
end

function BlizzMove:ADDON_LOADED(_, addOnName)
if addOnName ~= self.name then self:ProcessFrames(addOnName); end
self:ProcessFrames(addOnName);

-- fix a stupid anchor family connection issue blizzard added in 9.1.5
if addOnName == "Blizzard_Collections" then
Expand Down Expand Up @@ -1312,19 +1323,4 @@ do
end
end
end

function BlizzMove:OnEnable()
self.enabled = true;
self:SavePositionStrategyChanged(nil, self.DB.savePosStrategy);
C_CVar.SetCVar('enableSourceLocationLookup', 1)

self:ADDON_LOADED(_, self.name);
for addOnName, _ in pairs(self.Frames) do
if addOnName ~= self.name and IsAddOnLoaded(addOnName) then
self:ADDON_LOADED(_, addOnName);
end
end

self:RegisterEvent("ADDON_LOADED");
end
end
3 changes: 2 additions & 1 deletion Plugins/Debug/BlizzMoveDebug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ local GetAddOnMetadata = _G.GetAddOnMetadata or _G.C_AddOns.GetAddOnMetadata;
local GetFrameMetatable = _G.GetFrameMetatable or function() return getmetatable(CreateFrame('FRAME')) end
local LoadAddOn = _G.LoadAddOn or _G.C_AddOns.LoadAddOn;

--- @type BlizzMove
local BlizzMove = LibStub('AceAddon-3.0'):GetAddon('BlizzMove');
if not BlizzMove then return ; end

--- @class BlizzMove_Debug
--- @class BlizzMove_Debug: AceModule
local Module = BlizzMove:NewModule('Debug')
--- @type BlizzMoveAPI
local BlizzMoveAPI = BlizzMoveAPI;
Expand Down

0 comments on commit 38e4cb6

Please sign in to comment.