-- Placement belongs to the engine. These are Maniax CVar's existing controls; -- no native frame resizing, second collision solver, or automatic settings. local Addon = _G.ManiaxNamePlates local preset = { { "nameplateStacking", 2 }, { "nameplateRaiseDistance", 3 }, { "nameplatePullDistance", 0.1 }, } function Addon:GetStackingStatus() local value = GetCVar("nameplateStacking") local modes = { [0] = "Overlapping", [1] = "Stacking: all", [2] = "Stacking: enemies", [3] = "Stacking: friendly", [-1] = "Smart: all", [-2] = "Smart: enemies", [-3] = "Smart: friendly" } if not value then return "Stacking controls unavailable on this client.", false end return string.format("%s | Vertical push: %s plate heights | Horizontal pull: %s", modes[tonumber(value)] or tostring(value), GetCVar("nameplateRaiseDistance") or "?", GetCVar("nameplatePullDistance") or "?"), true end local function apply(values) local before = {} for _, entry in ipairs(values) do local current = GetCVar(entry[1]) if current == nil then return false, "Unavailable setting: " .. entry[1] end before[#before + 1] = { entry[1], current } end for _, entry in ipairs(values) do local ok = pcall(SetCVar, entry[1], tostring(entry[2])) if not ok or tonumber(GetCVar(entry[1])) ~= tonumber(entry[2]) then for _, previous in ipairs(before) do pcall(SetCVar, previous[1], previous[2]) end return false, "Could not apply " .. entry[1] .. ". Check Maniax CVar." end end return true, before end function Addon:ApplyCrowdedStacking() local ok, previous = apply(preset) if not ok then return false, previous end self.db.stackingRestore = self.db.stackingRestore or previous return true end function Addon:RestoreStacking() if not self.db.stackingRestore then return false, "No saved stacking settings to restore." end local ok, reason = apply(self.db.stackingRestore) if ok then self.db.stackingRestore = nil end return ok, reason end function Addon:OpenStackingOptions() if SlashCmdList.MANIAXCVAR then SlashCmdList.MANIAXCVAR("show") return true end return false, "Enable Maniax CVar to open its settings." end