correct mounted condition
This commit is contained in:
@@ -3112,6 +3112,40 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Mounted Frame
|
||||||
|
do
|
||||||
|
local mountedFrame
|
||||||
|
WeakAuras.frames["Mount Use Handler"] = mountedFrame;
|
||||||
|
local elapsed = 0;
|
||||||
|
local delay = 0.5;
|
||||||
|
local isMounted = IsMounted();
|
||||||
|
|
||||||
|
local function checkForMounted(self, elaps)
|
||||||
|
WeakAuras.StartProfileSystem("generictrigger");
|
||||||
|
elapsed = elapsed + elaps
|
||||||
|
if(isMounted ~= IsMounted()) then
|
||||||
|
isMounted = IsMounted();
|
||||||
|
WeakAuras.ScanEvents("MOUNTED_UPDATE");
|
||||||
|
mountedFrame:SetScript("OnUpdate", nil);
|
||||||
|
end
|
||||||
|
if(elapsed > delay) then
|
||||||
|
mountedFrame:SetScript("OnUpdate", nil);
|
||||||
|
end
|
||||||
|
WeakAuras.StopProfileSystem("generictrigger");
|
||||||
|
end
|
||||||
|
|
||||||
|
function WeakAuras.WatchForMounts()
|
||||||
|
if not(mountedFrame) then
|
||||||
|
mountedFrame = CreateFrame("frame");
|
||||||
|
mountedFrame:RegisterEvent("COMPANION_UPDATE");
|
||||||
|
mountedFrame:SetScript("OnEvent", function()
|
||||||
|
elapsed = 0;
|
||||||
|
mountedFrame:SetScript("OnUpdate", checkForMounted);
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Player Moving
|
-- Player Moving
|
||||||
do
|
do
|
||||||
local playerMovingFrame = nil
|
local playerMovingFrame = nil
|
||||||
|
|||||||
@@ -5074,6 +5074,7 @@ WeakAuras.event_prototypes = {
|
|||||||
if trigger.use_mounted ~= nil then
|
if trigger.use_mounted ~= nil then
|
||||||
tinsert(events, "COMPANION_UPDATE")
|
tinsert(events, "COMPANION_UPDATE")
|
||||||
tinsert(events, "PLAYER_ENTERING_WORLD")
|
tinsert(events, "PLAYER_ENTERING_WORLD")
|
||||||
|
tinsert(events, "MOUNTED_UPDATE")
|
||||||
end
|
end
|
||||||
local unit_events = {}
|
local unit_events = {}
|
||||||
local pet_unit_events = {}
|
local pet_unit_events = {}
|
||||||
@@ -5123,6 +5124,9 @@ WeakAuras.event_prototypes = {
|
|||||||
force_events = "CONDITIONS_CHECK",
|
force_events = "CONDITIONS_CHECK",
|
||||||
name = L["Conditions"],
|
name = L["Conditions"],
|
||||||
init = function(trigger)
|
init = function(trigger)
|
||||||
|
if(trigger.use_mounted ~= nil) then
|
||||||
|
WeakAuras.WatchForMounts();
|
||||||
|
end
|
||||||
return "";
|
return "";
|
||||||
end,
|
end,
|
||||||
args = {
|
args = {
|
||||||
|
|||||||
Reference in New Issue
Block a user