#Manually trigger TSU update?

1 messages · Page 1 of 1 (latest)

fading lotus
#

I'm writing a TSU which updates allstates when a system event happens, and I want to do the same update again after a certain time.
I can't use a callback function of the timer since it can't "return true" like TSU function does to tell WA to update allstates. I also can't fire the same event again since it's a system event which I can't fire by myself afaik.
Now I have to fire a custom event for this task. I wonder if there's a better way to do this?

Contexts:

  • I am making a WA for feral druid bloodtalons (BT), which show me which spells I can cast to count towards BT.
  • I use TSU to show the spell icons

The key part in my code:

function(allstates, event, ...)
    -- skipped
    local this = aura_env
    if event == "UNIT_SPELLCAST_SUCCEEDED" then
        local unitTarget, _, spellID = ...
        if unitTarget == "player" and this.spellIDs[spellID] then
            this.spellCastTimes[spellID] = GetTime()
            -- Updates again when timer ends
            C_Timer.After(this.BLOODTALONS_TIME_WINDOW, function()
                WeakAuras.ScanEvents("JOEGNIS_BTSTC_REFRESH")
            end)
            changed = this.updateIcons(allstates)
        end
    elseif ...
end
limber magnet
#

What so you have against scanevents?

fading lotus
limber magnet
#

They arent

fading lotus
#

maybe im too strict😂

limber magnet
#

That's exactly the fun with it. They aren't global. They just call a function that listens to the specific event.

fading lotus
#

all auras can "hear" them, aren't they

limber magnet
#

But they can't change it. And if you are specific they won't hear them.

#

That's like not calling a function because someone else could have hooked it

fading lotus
limber magnet
#

Yes.