Keep the rangecheck scanner alive across zones and roster changes

PLAYER_LEAVING_WORLD fires on every loading screen, not just logout, but
librange treated it as terminal: it latched librange_isLoggingOut and
tore OnUpdate off the frame, neither of which was ever restored. So the
first zone (into a BG, dungeon, etc.) permanently killed the distance
scan -- unitdata stopped updating and UnitInSpellRange defaulted every
unit to in-range until /reload, which the next loading screen then undid.
Only PLAYER_LOGOUT is terminal now; PLAYER_LEAVING_WORLD just hides for
the loading screen and PLAYER_ENTERING_WORLD re-shows it.

Also invalidate on RAID_ROSTER_UPDATE / PARTY_MEMBERS_CHANGED: the range
state is cached per unit token, so a roster re-index leaves each unitN
mapped to a different player with stale data. Clear the token cache and
restart the sweep so shifted/joined slots are re-evaluated within one
pass instead of inheriting the previous occupant's range.
This commit is contained in:
Brues
2026-07-20 14:12:07 -05:00
parent b2db091d54
commit 756e8840af
+18 -2
View File
@@ -61,14 +61,30 @@ librange:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
librange:RegisterEvent("PLAYER_ENTERING_WORLD")
librange:RegisterEvent("PLAYER_LOGOUT")
librange:RegisterEvent("PLAYER_LEAVING_WORLD")
librange:RegisterEvent("RAID_ROSTER_UPDATE")
librange:RegisterEvent("PARTY_MEMBERS_CHANGED")
librange:SetScript("OnEvent", function()
if event == "PLAYER_LOGOUT" or event == "PLAYER_LEAVING_WORLD" then
if event == "PLAYER_LOGOUT" then
librange_isLoggingOut = true
this:SetScript("OnUpdate", nil)
this:Hide()
return
end
if event == "PLAYER_LEAVING_WORLD" then
this:Hide()
return
end
if event == "RAID_ROSTER_UPDATE" or event == "PARTY_MEMBERS_CHANGED" then
-- Roster re-index: unitN tokens now map to different players, so the
-- token->realunit cache is stale. Clear it and restart the sweep from
-- the top so shifted/joined slots are re-evaluated within one pass
-- instead of inheriting the previous occupant's cached range.
for k in pairs(unitcache) do unitcache[k] = nil end
this.id = 1
return
end
if pfUI_config.unitframes.rangecheck == "0" then
this:Hide()
return