All of these lines will break the default UI and spam you with "action blocked" errors:
Code:
MainMenuBar.ClearAllPoints = bottom
MainMenuBar.SetPoint = bottom
OverrideActionBar.ClearAllPoints = bottom
OverrideActionBar.SetPoint = bottom
PetBattleFrame.BottomFrame.ClearAllPoints = bottom
PetBattleFrame.BottomFrame.SetPoint = bottom
You
can't override methods on secure frames this way. Even your other idea:
Code:
hooksecurefunc('OverrideActionBar_SetDefaultAnchor', function(self)
self:SetPoint(("BOTTOM", DataPanel, "TOP", 0, -3)
end)
... will throw errors because -- aside from having an extra parenthesis -- you
can't move a secure frame in combat either. You are on the right track, however. You just need to add a combat check to your secure hook:
Code:
hooksecurefunc("OverrideActionBar_SetDefaultAnchor", function(self)
if not InCombatLockdown() then
self:SetPoint("BOTTOM", DataPanel, "TOP", 0, -3)
end
end)
You may also want to add a "queue" so that any frames that were moved during combat (when you can't move them) can be moved after combat ends:
Code:
local queue = {}
local queueHandler = CreateFrame("Frame")
queueHandler:RegisterEvent("PLAYER_REGEN_ENABLED")
queueHandler:SetScript("OnEvent", function(self, event)
for i = 1, #queue do
local frame, pointA, anchor, pointB, x, y = unpack(queue[i])
frame:SetPoint(pointA, anchor, pointB, x, y)
end
end)
hooksecurefunc("OverrideActionBar_SetDefaultAnchor", function(self)
if not InCombatLockdown() then
self:SetPoint("BOTTOM", DataPanel, "TOP", 0, -3)
else
tinsert(queue, { self, "BOTTOM", DataPanel, "TOP", 0, -3 })
end
end)
Your other option, as you said, would be to hide your data panel while in a vehicle:
Code:
DataPanel:RegisterUnitEvent("UNIT_ENTERING_VEHICLE", "player")
DataPanel:RegisterUnitEvent("UNIT_EXITED_VEHICLE", "player")
DataPanel:SetScript("OnEvent", function(self, event, ...)
if event == "UNIT_ENTERING_VEHICLE" then
self:Hide()
elseif event == "UNIT_EXITED_VEHICLE" then
self:Show()
end
end)