correct mounted condition

This commit is contained in:
Bunny67
2020-06-06 02:50:25 +03:00
parent 96437b0412
commit 55d2ce2aed
2 changed files with 38 additions and 0 deletions
+34
View File
@@ -3112,6 +3112,40 @@ do
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
do
local playerMovingFrame = nil
+4
View File
@@ -5074,6 +5074,7 @@ WeakAuras.event_prototypes = {
if trigger.use_mounted ~= nil then
tinsert(events, "COMPANION_UPDATE")
tinsert(events, "PLAYER_ENTERING_WORLD")
tinsert(events, "MOUNTED_UPDATE")
end
local unit_events = {}
local pet_unit_events = {}
@@ -5123,6 +5124,9 @@ WeakAuras.event_prototypes = {
force_events = "CONDITIONS_CHECK",
name = L["Conditions"],
init = function(trigger)
if(trigger.use_mounted ~= nil) then
WeakAuras.WatchForMounts();
end
return "";
end,
args = {