From dca3b31f9ddb014e6062b0a23a96e4367de44a6b Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Mon, 1 Sep 2008 10:24:40 +0000 Subject: [PATCH] change visibility driver to hide pet-bar when possessing, as blizzard doesn't give you a pet-bar either when in a vehicle, for example. --- barPrototype/Prototype.lua | 3 +-- specialBars/PetBar.lua | 23 +++++++++-------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/barPrototype/Prototype.lua b/barPrototype/Prototype.lua index f4db92e..5c5d467 100644 --- a/barPrototype/Prototype.lua +++ b/barPrototype/Prototype.lua @@ -323,8 +323,7 @@ end function Bar:ApplyVisibilityDriver() if self.unlocked then return end -- default state is shown - self:RegisterVisibilityCondition("show") - RegisterStateDriver(self, "visibility", table_concat(self.hidedriver, ";")) + RegisterStateDriver(self, "visibility", table_concat(self.hidedriver, ";") .. ";show") end function Bar:DisableVisibilityDriver() diff --git a/specialBars/PetBar.lua b/specialBars/PetBar.lua index 1fffbfd..adc9737 100644 --- a/specialBars/PetBar.lua +++ b/specialBars/PetBar.lua @@ -35,12 +35,10 @@ function PetBarMod:OnEnable() self.bar:SetScript("OnEvent", PetBar.OnEvent) - self.bar:SetAttribute("unit", "pet") + --self.bar:SetAttribute("unit", "pet") end self.bar:Enable() - RegisterUnitWatch(self.bar, false) - self.bar:RegisterEvent("PLAYER_CONTROL_LOST") self.bar:RegisterEvent("PLAYER_CONTROL_GAINED") self.bar:RegisterEvent("PLAYER_FARSIGHT_FOCUS_CHANGED") @@ -62,7 +60,9 @@ end function PetBarMod:OnDisable() if not self.bar then return end - UnregisterUnitWatch(self.bar) + UnregisterStateDriver(self.bar) + self:SetAttribute("state-visibility", nil) + self.bar:Hide() self.bar:Disable() self:ToggleOptions() @@ -108,16 +108,11 @@ end function PetBar:ApplyConfig(config) ButtonBar.ApplyConfig(self, config) self:UpdateButtonLayout() + self:InitVisibilityDriver() + self:RegisterVisibilityCondition("[bonusbar:5]hide") + self:RegisterVisibilityCondition("[pet]show") + self:RegisterVisibilityCondition("hide") + self:ApplyVisibilityDriver() self:ForAll("Update") self:ForAll("ApplyStyle", self.config.style) end - -function PetBar:Unlock() - UnregisterUnitWatch(self) - ButtonBar.Unlock(self) -end - -function PetBar:Lock() - ButtonBar.Lock(self) - RegisterUnitWatch(self, false) -end