Skip to content

Commit

Permalink
Fix fading checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ls- committed Mar 4, 2023
1 parent 62c3581 commit 94065d9
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions ls_UI/core/fading.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ local function addTargetWidget(object, widget)
end

local function removeTargetWidget(object, widget)
widget.hasTarget = false
widget.hasTarget = nil
targetWidgets[object] = nil
end

Expand All @@ -46,7 +46,7 @@ local function addCombatWidget(object, widget)
end

local function removeCombatWidget(object, widget)
widget.inCombat = false
widget.inCombat = nil
combatWidgets[object] = nil
end

Expand All @@ -58,7 +58,7 @@ local function addHealthWidget(object, widget)
end

local function removeHealthWidget(object, widget)
widget.maxHealth = false
widget.maxHealth = nil
healthWidgets[object] = nil
end

Expand Down Expand Up @@ -142,9 +142,7 @@ updater:SetScript("OnEvent", function(self, event)
for object, widget in next, combatWidgets do
widget.inCombat = false

if not widget.hasTarget and widget.maxHealth then
object:EnableFading()
end
object:EnableFading()
end
elseif event == "PLAYER_TARGET_CHANGED" or event == "PLAYER_FOCUS_CHANGED" then
if UnitExists("target") or UnitExists("focus") then
Expand All @@ -161,9 +159,7 @@ updater:SetScript("OnEvent", function(self, event)
for object, widget in next, targetWidgets do
widget.hasTarget = false

if not widget.inCombat and widget.maxHealth then
object:EnableFading()
end
object:EnableFading()
end

self.hasTarget = false
Expand All @@ -174,9 +170,7 @@ updater:SetScript("OnEvent", function(self, event)
for object, widget in next, healthWidgets do
widget.maxHealth = true

if not (widget.inCombat or widget.hasTarget) then
object:EnableFading()
end
object:EnableFading()
end

self.maxHealth = true
Expand Down Expand Up @@ -245,7 +239,7 @@ function addHoverWidget(object, widget)
end

function removeHoverWidget(object, widget)
widget.canHover = false
widget.canHover = nil
hoverWidgets[object] = nil

if not next(hoverWidgets) then
Expand All @@ -271,7 +265,7 @@ end
function object_proto:EnableFading()
local widget = widgets[self]

if not (widget.hasTarget or widget.inCombat) then
if not (widget.inCombat or widget.hasTarget) and widget.maxHealth ~= false then
addHoverWidget(self, widget)
end
end
Expand Down

0 comments on commit 94065d9

Please sign in to comment.