# HG changeset patch # User contrebasse # Date 1294502400 -3600 # Node ID 83cfab9dcb637daa8ba305fdf092972931a556ce # Parent 6f99c7f30f156509e7d88d31d6bd313131790882 Weapon is not stealthed while moving and talking / Use a constant for short delay (0.5s) / the long delay is now 2.5s to avoid clipping with emotes diff -r 6f99c7f30f15 -r 83cfab9dcb63 Degaine.lua --- a/Degaine.lua Sat Jan 08 16:09:53 2011 +0100 +++ b/Degaine.lua Sat Jan 08 17:00:00 2011 +0100 @@ -25,6 +25,7 @@ -- Lua functions local pairs = pairs; local type = type; +local select = select -- Wow functions local GetTime = GetTime @@ -34,7 +35,7 @@ local IsMounted = IsMounted local GetNumCompanions, GetCompanionInfo = GetNumCompanions, GetCompanionInfo local UnitCastingInfo = UnitCastingInfo -local select = select +local GetUnitSpeed = GetUnitSpeed --------------------------------------------------------------- @@ -43,7 +44,8 @@ -- const local DegaineFrame = CreateFrame("Frame") local playername = UnitName("player") -local delay = 2 -- seconds +local delay = 2.5 -- seconds +local delay_short = 0.5 -- seconds -- vars local t_left = -1 @@ -165,10 +167,13 @@ -- Archaeology ? } +local function playerIsNotMoving() + return GetUnitSpeed("player") == 0 +end local events2playername = { -- the 2nd arg is playername - CHAT_MSG_SAY = true, - CHAT_MSG_YELL = true, - CHAT_MSG_TEXT_EMOTE = true, + CHAT_MSG_SAY = playerIsNotMoving, + CHAT_MSG_YELL = playerIsNotMoving, + CHAT_MSG_TEXT_EMOTE = true, -- the emote is not shown, but the weapon is stealthed } @@ -190,7 +195,7 @@ wasMounted = true else if wasMounted then - start(0.5) -- no animation for unmounting + start(delay_short) -- no animation for unmounting wasMounted = false end end @@ -288,11 +293,11 @@ --elseif arg5 and not SpellBlackList[arg5] then -- arg5 is SpellID elseif (arg5 and SpellWhiteList[arg5]) or isTradeSkill then -- arg5 is SpellID isTradeSkill = false -- for next time - start(0.5) + start(delay_short) end end elseif events2playername[event] then - if arg2==playername then + if arg2==playername and (type(events2playername[event])~="function" or events2playername[event]()) then start() end elseif event == "GOSSIP_CLOSED" then