diff Degaine.lua @ 10:37ac0d31cf0e

No need for this 'done' var anymore
author contrebasse
date Fri, 10 Dec 2010 16:53:18 +0100
parents 571dcc76d801
children 62abf847fef9
line wrap: on
line diff
--- a/Degaine.lua	Fri Dec 10 16:44:07 2010 +0100
+++ b/Degaine.lua	Fri Dec 10 16:53:18 2010 +0100
@@ -2,7 +2,8 @@
 -- Draw your weapons automagically
 
 -- Known bugs :
--- si on se lève en sautant ça ne sort pas l'arme (impossible de savoir si on était assis avant)
+-- If you stand up by jumping or walking it won't draw your weapon
+--     (it's not possible to know if you were sitting or standing before)
 
 --@debug@
 local debug = false;
@@ -34,7 +35,6 @@
 local playername = UnitName("player")
 
 -- vars
-local done = true
 local t_left = -1
 local delay = 2 -- seconds
 
@@ -81,19 +81,15 @@
 ---------------------------------------------------------------
 -- Wait a few seconds before drawing, to be able to see the curren animation (and avoid bugs)
 local Degaine_OnUpdate = function(self,t_elapsed)
-	if not done then
-		t_left = t_left - t_elapsed;
-		if t_left<=0 then
-			done = true;
-			ToggleSheath();
-			DegaineFrame:SetScript("OnUpdate", nil);
-		end
+	t_left = t_left - t_elapsed;
+	if t_left<=0 then
+		ToggleSheath();
+		DegaineFrame:SetScript("OnUpdate", nil);
 	end
 end
 local start = function()
 	if Degaine_isAuto and not InCombatLockdown() then
 		t_left = delay
-		done = false
 		DegaineFrame:SetScript("OnUpdate", Degaine_OnUpdate);
 	end
 end
@@ -122,7 +118,6 @@
 	for k,v in pairs(events1player) do DegaineFrame:UnregisterEvent(k); end
 	for k,v in pairs(events2playername) do DegaineFrame:UnregisterEvent(k); end
 	DegaineFrame:SetScript("OnUpdate", nil);
-	done = true;
 end
 Degaine_ToggleAuto = function()
 	if Degaine_isAuto then