Quantcast

Fix Kungaloosh disabling itself when zoning.

Christopher Rosell [01-02-12 - 04:41]
Fix Kungaloosh disabling itself when zoning.
Filename
kungaloosh.lua
diff --git a/kungaloosh.lua b/kungaloosh.lua
index a00ec2f..983a08e 100755
--- a/kungaloosh.lua
+++ b/kungaloosh.lua
@@ -162,7 +162,9 @@ function addon:GetMinThreat()
 end

 function addon:EnableIfTank()
-	local istank = (UnitGroupRolesAssigned"player" == "TANK") or (GetPartyAssignment("MAINTANK", "player") == 1)
+	if self.enabled then return end
+
+	local istank = (UnitGroupRolesAssigned("player") == "TANK") or (GetPartyAssignment("MAINTANK", "player") == 1)

 	if istank then
 		local enable = false
@@ -190,7 +192,6 @@ function addon:Enable(msg)
 	self:RegisterEvent"UNIT_THREAT_LIST_UPDATE"
 	self:RegisterEvent"RAID_TARGET_UPDATE"
 	self:RegisterEvent"COMBAT_LOG_EVENT_UNFILTERED"
-	self.enabled = true

 	self:ResetState()

@@ -204,7 +205,6 @@ function addon:Disable(msg)
 	self:UnregisterEvent"UNIT_THREAT_LIST_UPDATE"
 	self:UnregisterEvent"RAID_TARGET_UPDATE"
 	self:UnregisterEvent"COMBAT_LOG_EVENT_UNFILTERED"
-	self.enabled = false

 	if msg then self:Print(msg) end
 end
@@ -212,8 +212,10 @@ end
 function addon:Toggle()
 	if not self.enabled then
 		self:Enable(L["is now enabled"])
+		self.enabled = true
 	else
 		self:Disable(L["is now disabled"])
+		self.enabled = false
 	end
 end