Files
Brues 9bebbbb836 Fix addon initialization order with guard checks
Refactor mouseover extensions to split initialization into two phases: OnLoad (empty) and OnAddOnLoad (actual setup). This ensures hooks are only registered when the target addon's globals are defined. Add guard clauses to check for required functions before hooking. Also remove Cursive's premature initialization attempt.
2026-07-27 14:32:12 -05:00

41 lines
1.1 KiB
Lua

--[[
Author: Dennis Werner Garske (DWG) / brian / Mewtiny
License: MIT License
]]
local _G = _G or getfenv(0)
local CleveRoids = _G.CleveRoids or {}
local Extension = CleveRoids.RegisterExtension("CT_UnitFrames")
function Extension.SetHook(widget)
local hookedOnEnter = widget:GetScript("OnEnter")
local hookedOnLeave = widget:GetScript("OnLeave")
widget:SetScript("OnEnter", function()
hookedOnEnter()
CleveRoids.SetMouseoverFrom("ctuf", "targettarget")
end)
widget:SetScript("OnLeave", function()
hookedOnLeave()
CleveRoids.ClearMouseoverFrom("ctuf")
CleveRoids.ClearMouseoverFrom("native")
end)
end
function Extension.OnLoad() end
function Extension.OnAddOnLoad()
if not CT_AssistFrame then
return
end
CleveRoids.Print("CT_UnitFrames module loaded.")
Extension.SetHook(CT_AssistFrame)
Extension.SetHook(CT_AssistFrameHealthBar)
Extension.SetHook(CT_AssistFrameManaBar)
Extension.SetHook(CT_AssistFrame_Drag)
end
EventUtil.ContinueOnAddOnLoaded("CT_UnitFrames", Extension.OnAddOnLoad)