Add ttl per frame

This commit is contained in:
2025-01-09 13:14:58 +01:00
parent 7c7edcf959
commit c0a6a3c082
2 changed files with 18 additions and 7 deletions

View File

@@ -10,7 +10,8 @@ function shared.MinimapTagger.Init()
---@param y number
---@param frame Frame
---@param scale number?
local function PlantFrame(x, y, frame, scale)
---@param ttl number?
local function PlantFrame(x, y, frame, scale, ttl)
scale = scale or 1
local w, h = BattlefieldMinimap:GetSize()
w, h = w * BattlefieldMinimap:GetEffectiveScale(), h * BattlefieldMinimap:GetEffectiveScale()
@@ -44,7 +45,7 @@ function shared.MinimapTagger.Init()
self.custom.progress = 0
self:SetScript("OnUpdate", function(self, elapsed)
self.custom.progress = self.custom.progress + elapsed
local progress = self.custom.progress / Heimdall_Data.config.minimapTagger.ttl
local progress = self.custom.progress / ttl
if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Alert progress%%: %f", ModuleName, progress))
print(string.format("[%s] Alert progress: %f", ModuleName, self.custom.progress))
@@ -91,7 +92,7 @@ function shared.MinimapTagger.Init()
end
return
end
PlantFrame(x, y, frame, scale)
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.alertTTL)
end
---@type Frame[]
@@ -123,7 +124,7 @@ function shared.MinimapTagger.Init()
end
return
end
PlantFrame(x, y, frame, scale)
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.tagTTL)
end
---@type Frame[]
@@ -155,7 +156,7 @@ function shared.MinimapTagger.Init()
end
return
end
PlantFrame(x, y, frame, scale)
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.combatTTL)
end
local pauseUntil = 0