Refactor orecamper to be a bit more accurate
This commit is contained in:
@@ -16,24 +16,21 @@ function(allstates, e, ...)
|
|||||||
if aura_env.lastEvent > 0 and currentTime - aura_env.lastEvent < aura_env.throttle then return end
|
if aura_env.lastEvent > 0 and currentTime - aura_env.lastEvent < aura_env.throttle then return end
|
||||||
aura_env.lastEvent = currentTime
|
aura_env.lastEvent = currentTime
|
||||||
|
|
||||||
print("Current time: " .. currentTime)
|
|
||||||
local lastEventTime = aura_env.lastEventTimes[targetGUID] or currentTime
|
local lastEventTime = aura_env.lastEventTimes[targetGUID] or currentTime
|
||||||
print("Last event time: " .. lastEventTime)
|
|
||||||
local timeSinceLastEvent = currentTime - lastEventTime
|
local timeSinceLastEvent = currentTime - lastEventTime
|
||||||
print("Time since last event: " .. timeSinceLastEvent)
|
|
||||||
|
|
||||||
local dynamicCooldown = math.min(300, timeSinceLastEvent)
|
local cooldown = timeSinceLastEvent
|
||||||
|
if cooldown == 0 then cooldown = aura_env.cooldown end
|
||||||
local state = {
|
local state = {
|
||||||
changed = true,
|
changed = true,
|
||||||
show = true,
|
show = true,
|
||||||
progressType = "timed",
|
progressType = "timed",
|
||||||
autoHide = true,
|
autoHide = true,
|
||||||
duration = dynamicCooldown,
|
duration = cooldown,
|
||||||
expirationTime = currentTime + dynamicCooldown,
|
expirationTime = currentTime + cooldown,
|
||||||
name = string.format("%s", targetName),
|
name = string.format("%s", targetName),
|
||||||
}
|
}
|
||||||
|
|
||||||
print(string.format("Setting time for %s to %d", targetGUID, currentTime))
|
|
||||||
aura_env.lastEventTimes[targetGUID] = currentTime
|
aura_env.lastEventTimes[targetGUID] = currentTime
|
||||||
allstates[targetGUID] = state
|
allstates[targetGUID] = state
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
aura_env.cooldown = 300
|
aura_env.cooldown = 240
|
||||||
aura_env.depositIterator = {}
|
aura_env.depositIterator = {}
|
||||||
aura_env.lastEventTimes = {}
|
aura_env.lastEventTimes = {}
|
||||||
aura_env.throttle = 0.5
|
aura_env.throttle = 0.5
|
||||||
|
|||||||
Reference in New Issue
Block a user