Add configuration for textures

This commit is contained in:
2025-01-09 16:51:03 +01:00
parent 6becc08e18
commit 6b74e01f0a
3 changed files with 167 additions and 101 deletions

View File

@@ -79,7 +79,7 @@ function shared.MinimapTagger.Init()
frame.custom = { busy = false }
local texture = frame:CreateTexture(nil, "ARTWORK")
texture:SetAllPoints(frame)
texture:SetTexture(TextureRoot .. "Alert.tga")
texture:SetTexture(TextureRoot .. Heimdall_Data.config.minimapTagger.alertTextureFile)
table.insert(alertFramePool, frame)
end
local muteAlertUntil = 0
@@ -131,7 +131,7 @@ function shared.MinimapTagger.Init()
frame.custom = { busy = false }
local texture = frame:CreateTexture(nil, "ARTWORK")
texture:SetAllPoints(frame)
texture:SetTexture(TextureRoot .. "Tag.tga")
texture:SetTexture(TextureRoot .. Heimdall_Data.config.minimapTagger.tagTextureFile)
table.insert(tagFramePool, frame)
end
local muteTagUntil = 0
@@ -174,27 +174,27 @@ function shared.MinimapTagger.Init()
end
--endregion
--region Battle
--region Combat
---@type Frame[]
local battleFramePool = {}
local battleFramePoolMaxSize = 20
for i = 1, battleFramePoolMaxSize do
local combatFramePool = {}
local combatFramePoolMaxSize = 20
for i = 1, combatFramePoolMaxSize do
local frame = CreateFrame("Frame")
frame.custom = { busy = false }
local texture = frame:CreateTexture(nil, "ARTWORK")
texture:SetAllPoints(frame)
texture:SetTexture(TextureRoot .. "Fight.tga")
table.insert(battleFramePool, frame)
texture:SetTexture(TextureRoot .. Heimdall_Data.config.minimapTagger.combatTextureFile)
table.insert(combatFramePool, frame)
end
local muteBattleUntil = 0
local muteCombatUntil = 0
---@param x number
---@param y number
---@param scale number?
local function PlantBattle(x, y, scale)
local function PlantCombat(x, y, scale)
local frame = nil
for _, battleFrame in ipairs(battleFramePool) do
if not battleFrame.custom.busy then
frame = battleFrame
for _, combatFrame in ipairs(combatFramePool) do
if not combatFrame.custom.busy then
frame = combatFrame
break
end
end
@@ -209,12 +209,12 @@ function shared.MinimapTagger.Init()
print(string.format("[%s] Playing combat sound: %s", ModuleName,
Heimdall_Data.config.minimapTagger.combatSoundFile))
end
if muteBattleUntil > GetTime() then
if muteCombatUntil > GetTime() then
if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Combat sound is muted until %d", ModuleName, muteBattleUntil))
print(string.format("[%s] Combat sound is muted until %d", ModuleName, muteCombatUntil))
end
else
muteBattleUntil = GetTime() + Heimdall_Data.config.minimapTagger.combatSoundThrottle
muteCombatUntil = GetTime() + Heimdall_Data.config.minimapTagger.combatSoundThrottle
local ok = PlaySoundFile(SoundRoot .. Heimdall_Data.config.minimapTagger.combatSoundFile, "Master")
if not ok and Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Failed to play combat sound: %s", ModuleName,
@@ -235,7 +235,7 @@ function shared.MinimapTagger.Init()
frame.custom = { busy = false }
local texture = frame:CreateTexture(nil, "ARTWORK")
texture:SetAllPoints(frame)
texture:SetTexture(TextureRoot .. "Help.tga")
texture:SetTexture(TextureRoot .. Heimdall_Data.config.minimapTagger.helpTextureFile)
table.insert(helpFramePool, frame)
end
local muteHelpUntil = 0