From 54e3c3b3f4dc5180981fcc67d59164a4866674df Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Mon, 14 Sep 2026 20:15:42 -0500 Subject: [PATCH] Drop the dead C_LossOfControl gate The LOSS_OF_CONTROL_ADDED/UPDATE registration was wrapped in a `type(C_LossOfControl) == "table"` check, to keep an older ClassicAPI without the namespace from erroring on an unknown event. That can't happen: C_LossOfControl ships in v1.10.0, and the addon refuses to finish loading below v1.15.0. Same shape as the health/power fallbacks removed just before this. GetSchoolLockout's comment claimed it "Returns 0 for a client without C_LossOfControl", which was not merely obsolete but wrong -- the function indexes C_LossOfControl unguarded on its first line, so a missing namespace raises rather than returning 0. The sentence describes a guard that was never there. Left alone: the C_Macro.SetMacroDisplay feature-detect in Init.lua looks like the same pattern but isn't. SetMacroDisplay lands in v1.15.0, exactly the floor, so a nil there means the client mod is absent outright, and the flag doubles as the internal "may we publish" guard that ReleaseDisplays clears. --- ClassicAPI.lua | 4 ++-- Core.lua | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/ClassicAPI.lua b/ClassicAPI.lua index f159369..7958dce 100644 --- a/ClassicAPI.lua +++ b/ClassicAPI.lua @@ -247,8 +247,8 @@ end -- Pummel / Earth Shock lockout) on the player, or 0 when not kicked. Read from -- C_LossOfControl, which synthesizes the lockout from the server's own -- SMSG_SPELL_COOLDOWN packet -- a state no debuff scan can see. Also returns the --- seconds remaining (nil if ClassicAPI didn't observe the applying cast). Returns --- 0 for a client without C_LossOfControl. Player-only (vanilla LoC is local-only). +-- seconds remaining (nil if ClassicAPI didn't observe the applying cast). +-- Player-only (vanilla LoC is local-only). function API.GetSchoolLockout() local n = C_LossOfControl.GetActiveLossOfControlDataCount() or 0 for i = 1, n do diff --git a/Core.lua b/Core.lua index 82b62a7..5a2e835 100644 --- a/Core.lua +++ b/Core.lua @@ -4462,12 +4462,8 @@ CleveRoids.Frame:RegisterEvent("UPDATE_SHAPESHIFT_FORM") CleveRoids.Frame:RegisterEvent("SPELL_UPDATE_COOLDOWN") CleveRoids.Frame:RegisterEvent("PLAYER_STARTED_MOVING") -- ClassicAPI loss-of-control (school-interrupt lockout) for [locked]/[nolocked]. --- Gated on the namespace so an older ClassicAPI without it doesn't error on an --- unknown event. -if type(C_LossOfControl) == "table" then - CleveRoids.Frame:RegisterEvent("LOSS_OF_CONTROL_ADDED") - CleveRoids.Frame:RegisterEvent("LOSS_OF_CONTROL_UPDATE") -end +CleveRoids.Frame:RegisterEvent("LOSS_OF_CONTROL_ADDED") +CleveRoids.Frame:RegisterEvent("LOSS_OF_CONTROL_UPDATE") -- The unit state streams that drive icon refresh: GUID events when Nampower -- provides them (v2.39+, one event per unit change rather than one per token), -- else the stock per-token events. These cannot become RegisterUnitEvent calls