+ if slot < 13 then
+ -- first action bar has possible states based on vehicle/possess etc.
+ secure:SetAttribute("origaction", slot);
+ secure:SetAttribute("_onstate-possess", [=[
+ if newstate == "possess" then
+ local slot;
+ if HasVehicleActionBar() then
+ slot = (GetVehicleBarIndex()-1)*12+self:GetAttribute("origaction");
+ elseif HasOverrideActionBar() then
+ slot = (GetOverrideBarIndex()-1)*12+self:GetAttribute("origaction");
+ elseif HasTempShapeshitftActionBar() then
+ slot = (GetTempShapeshiftBarIndex()-1)*12+self:GetAttribute("origaction");
+ else
+ -- something wrong, just revert to normal
+ print("Possess bar index not found");
+ slot = self:GetAttribute("origaction");
+ end
+ self:SetAttribute("action", slot);
+ else
+ self:SetAttribute("action", self:GetAttribute("origaction"));
+ end
+ self:CallMethod("ActionChanged");
+ ]=]);
+ RegisterStateDriver(secure, "possess", "[overridebar][possessbar][shapeshift] possess; normal");
+ else
+ function secure:ShowButton() if HasAction(slot) then activeButtons[slot] = self end end
+ function secure:HideButton() activeButtons[slot] = nil end
+ -- all other action bar are hidden if with overridebar or vehicleui (not shapeshift, possessbar)
+ -- default Bartender4 options
+ secure:SetAttribute("_onstate-possess", [=[
+ if newstate == "possess" then
+ self:Hide();
+ self:CallMethod("HideButton");
+ else
+ self:Show();
+ self:CallMethod("ShowButton");
+ end
+ ]=]);
+ RegisterStateDriver(secure, "possess", "[overridebar][vehicleui] possess; normal");
+ end