diff --git a/actionBar/States.lua b/actionBar/States.lua index 5fc8e09..9eb2714 100644 --- a/actionBar/States.lua +++ b/actionBar/States.lua @@ -126,20 +126,17 @@ function ActionBar:UpdateStates() end end - table_insert(statedriver, tostring(self:GetDefaultState() or 0)) - - RegisterStateDriver(self, "page", table_concat(statedriver, ";")) - - self:ApplyStateButton() - self:SetAttribute("_onstate-page", [[ self:SetAttribute("state", newstate) _G["newBTState"] = newstate return true ]]) - local newState = self:GetAttribute("state-page") - self:SetAttribute("state", newState) + table_insert(statedriver, tostring(self:GetDefaultState() or 0)) + RegisterStateDriver(self, "page", table_concat(statedriver, ";")) + + --local newState = self:GetAttribute("state-page") + --self:SetAttribute("state", newState) self:ApplyVisibilityDriver() end @@ -189,16 +186,6 @@ function ActionBar:AddRightClickState(state) self:SetAttribute("unit-S" .. state .. "Right", target) end -function ActionBar:ApplyStateButton() - local states1, states2 = {}, {} - for _,v in pairs(self.statebutton) do - table_insert(states1, fmt("%s:S%s;", v, v)) - table_insert(states2, fmt("%s:S%sRight;", v, v)) - end - self:SetAttribute("statebutton", table_concat(states1, "")) - self:SetAttribute("statebutton2", table_concat(states2, "")) -end - function ActionBar:GetStateOption(key) return self.config.states[key] end diff --git a/buttonPrototypes/ActionButton.lua b/buttonPrototypes/ActionButton.lua index 86df1d1..4d37fdb 100644 --- a/buttonPrototypes/ActionButton.lua +++ b/buttonPrototypes/ActionButton.lua @@ -90,14 +90,9 @@ function Bartender4.Button:Create(id, parent) button:SetAttribute("action", absid) button:SetAttribute("useparent-unit", true) - button:SetAttribute("useparent-statebutton", true) --button:SetAttribute("hidestates", "-1") parent:SetAttribute('_adopt', button) - button:SetAttribute('_childupdate', [[ - self:SetAttribute("state", newBTState) - ]] - ) button:RegisterForDrag("LeftButton", "RightButton") button:RegisterForClicks("AnyUp") @@ -197,12 +192,6 @@ end function Button:ClearStateAction() for state in pairs(self.stateactions) do - self:SetAttribute(("*type-S%d"):format(state), nil) - self:SetAttribute(("*action-S%d"):format(state), nil) - self:SetAttribute(("*action-S%dRight"):format(state), nil) - self:SetAttribute(("*macrotext-S%d"):format(state), nil) - self:SetAttribute(("*macrotext-S%dRight"):format(state), nil) - self.stateactions = {} self.stateconfig = {} end @@ -223,10 +212,11 @@ end function Button:RebuildStateFunction() local newFunc = "local config = newtable()\n" for state, config in pairs(self.stateconfig) do - newFunc = newFunc .. ("local config_part = newtable(); config_part.type = %q; config_part.action = %d; config_part.macrotext = %q; config[%d] = config_part;\n"):format(config.type, config.action, config.macrotext, state) + newFunc = newFunc .. ("local config_part = newtable(); config_part.type = %q; config_part.action = %d; config_part.macrotext = %q; config[%d] = config_part;\n"):format(config.type, config.action, config.macrotext or "", state) end newFunc = newFunc .. [[ local state = tonumber(newBTState) + self:SetAttribute("state", state) self:SetAttribute("type", config[state].type) self:SetAttribute("action", config[state].action) self:SetAttribute("macrotext", config[state].macrotext) @@ -237,7 +227,7 @@ end function Button:RefreshStateAction(state) local state = tonumber(state or self:GetAttribute("state")) local action = self.stateactions[state] - local config = { type = "action", action = action, macrotext = action } + local config = { type = "action", action = action, macrotext = nil } if self.parent.config.autoassist then local type, id, subtype = GetActionInfo(action)