comparison Degaine.lua @ 47:f861e1c0535b v1.0beta11

Take into account that sheathing while drawing doesn't actually sheath
author contrebasse
date Sun, 27 Feb 2011 21:24:10 +0100
parents 1967c9a3c5c2
children 94566cb4534f
comparison
equal deleted inserted replaced
46:f50094e78073 47:f861e1c0535b
51 local isGossipClosed = true 51 local isGossipClosed = true
52 local wasGossipOpened = false 52 local wasGossipOpened = false
53 local t_lastGossipClosed = 0 53 local t_lastGossipClosed = 0
54 --local wasMounted = IsMounted() -- handle mounts with UNIT_AURA 54 --local wasMounted = IsMounted() -- handle mounts with UNIT_AURA
55 local isTradeSkill = false 55 local isTradeSkill = false
56 local t_lastDegaine = 0 -- Time of the last draw
56 57
57 58
58 --------------------------------------------------------------- 59 ---------------------------------------------------------------
59 -- Some stuff... 60 -- Some stuff...
60 --------------------------------------------------------------- 61 ---------------------------------------------------------------
74 local Degaine_OnUpdate = function(self,t_elapsed) 75 local Degaine_OnUpdate = function(self,t_elapsed)
75 t_left = t_left - t_elapsed; 76 t_left = t_left - t_elapsed;
76 if t_left<=0 then 77 if t_left<=0 then
77 ToggleSheath() 78 ToggleSheath()
78 DegaineFrame:SetScript("OnUpdate", nil) 79 DegaineFrame:SetScript("OnUpdate", nil)
80 t_lastDegaine = GetTime()
79 end 81 end
80 end 82 end
81 local start = function(arg_delay) 83 local start = function(arg_delay)
82 84
83 --@debug@ 85 --@debug@
84 --DEFAULT_CHAT_FRAME:AddMessage("Go !") 86 --DEFAULT_CHAT_FRAME:AddMessage("Go !")
85 --@end-debug@ 87 --@end-debug@
86 88
87 if Degaine_isAuto and not InCombatLockdown() then 89 if Degaine_isAuto and (GetTime()-t_lastDegaine)>1 and not InCombatLockdown() then
88 t_left = arg_delay or delay 90 t_left = arg_delay or delay
89 DegaineFrame:SetScript("OnUpdate", Degaine_OnUpdate) 91 DegaineFrame:SetScript("OnUpdate", Degaine_OnUpdate)
90 end 92 end
91 end 93 end
92 94