Skip to content

Commit d1a6135

Browse files
committed
call ClearAllPoints thru local func instead of hooking UpdateFillBar
1 parent 2d7e57c commit d1a6135

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

CompactUnitFrame_Update.lua

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
local _, ns = ...
22
local OVERSHIELD_TICK_OFFSET = -7
33

4-
-- Hook into the base UI function to clear points before it sets them
5-
hooksecurefunc("CompactUnitFrameUtil_UpdateFillBar", function(frame, previousTexture, bar, amount, barOffsetXPercent)
6-
if type(bar) == "userdata"
7-
and bar.ClearAllPoints
8-
and not (bar.IsForbidden and bar:IsForbidden())
9-
then
10-
-- TODO: Handle error - determine if needed?
11-
-- (discarded) success, error
12-
local _, _ = pcall(function()
4+
local function clearAllPoints(bar)
5+
-- TODO: Catch error - determine if handling needed?
6+
-- _, (discarded) error
7+
local success, _ = pcall(function()
8+
if bar.ClearAllPoints and not (bar.IsForbidden and bar:IsForbidden()) then
139
bar:ClearAllPoints()
14-
end)
10+
end
11+
end)
12+
if not success then
13+
print("[OSR] CompactUnitFrameUtil_UpdateFillBar: ClearAllPoints produced an error for: ", bar:GetName())
14+
print("[OSR] Please report this! (https://github.com/creed-us/Overshields_Reforged).")
1515
end
16-
end)
16+
end
1717

1818
ns.HandleCompactUnitFrame_Update = function(frame)
1919
local db = OvershieldsReforged.db.profile
@@ -62,7 +62,8 @@ ns.HandleCompactUnitFrame_Update = function(frame)
6262

6363
-- Handle overshieldTick prior to shieldOverlay and shieldBar to ensure correct visibility
6464
if hasOvershield then
65-
overshieldTick:ClearAllPoints()
65+
clearAllPoints(overshieldTick)
66+
--overshieldTick:ClearAllPoints()
6667
if hasMissingHealth then
6768
overshieldTick:SetPoint("TOPLEFT", healthBar, "TOPRIGHT", OVERSHIELD_TICK_OFFSET, 0)
6869
overshieldTick:SetPoint("BOTTOMLEFT", healthBar, "BOTTOMRIGHT", OVERSHIELD_TICK_OFFSET, 0)
@@ -92,7 +93,8 @@ ns.HandleCompactUnitFrame_Update = function(frame)
9293

9394

9495
-- Handle shieldOverlay visibility and positioning
95-
shieldOverlay:ClearAllPoints()
96+
clearAllPoints(shieldOverlay)
97+
--shieldOverlay:ClearAllPoints()
9698
shieldOverlay:SetParent(healthBar)
9799
-- Apply the texture and ensure proper tiling
98100
local tileSize = shieldOverlay.tileSize or 128
@@ -122,6 +124,7 @@ ns.HandleCompactUnitFrame_Update = function(frame)
122124
end
123125

124126
-- Handle shieldBar visibility and positioning
127+
clearAllPoints(shieldBar)
125128
shieldBar:ClearAllPoints()
126129
-- Apply custom color/alpha, blend mode, and texture to shieldBar
127130
local shieldBarColor = db.shieldBarColor

0 commit comments

Comments
 (0)