Refactor AgentTracker and related modules to improve agent management and logging
This commit is contained in:
@@ -5,12 +5,6 @@ local ModuleName = "Macroer"
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Macroer = {}
|
||||
function shared.Macroer.Init()
|
||||
---@class stinky
|
||||
---@field name string
|
||||
---@field class string
|
||||
---@field seenAt number
|
||||
---@field hostile boolean
|
||||
|
||||
local function FindOrCreateMacro(macroName)
|
||||
if Heimdall_Data.config.macroer.debug then
|
||||
print(string.format("[%s] Finding or creating macro: %s", ModuleName, macroName))
|
||||
@@ -27,7 +21,7 @@ function shared.Macroer.Init()
|
||||
return idx
|
||||
end
|
||||
|
||||
---@param stinkies table<string, stinky>
|
||||
---@param stinkies table<string, Stinky>
|
||||
local function FixMacro(stinkies)
|
||||
if Heimdall_Data.config.macroer.debug then
|
||||
print(string.format("[%s] Fixing macro with %d stinkies", ModuleName, #stinkies))
|
||||
@@ -53,7 +47,7 @@ function shared.Macroer.Init()
|
||||
|
||||
local sortedStinkies = {}
|
||||
for _, stinky in pairs(stinkies) do
|
||||
if not Heimdall_Data.config.agents[stinky.name] then sortedStinkies[#sortedStinkies + 1] = stinky end
|
||||
if not shared.AgentTracker.IsAgent(stinky.name) then sortedStinkies[#sortedStinkies + 1] = stinky end
|
||||
end
|
||||
|
||||
if Heimdall_Data.config.macroer.debug then
|
||||
@@ -89,12 +83,12 @@ function shared.Macroer.Init()
|
||||
EditMacro(idx, "HeimdallTarget", "INV_Misc_QuestionMark", body)
|
||||
end
|
||||
|
||||
shared.stinkyTracker.stinkies:onChange(function(value)
|
||||
shared.StinkyTracker.OnChange(function(stinkies)
|
||||
if Heimdall_Data.config.macroer.debug then
|
||||
print(string.format("[%s] Stinkies changed, updating macro", ModuleName))
|
||||
shared.dumpTable(value)
|
||||
shared.dumpTable(stinkies)
|
||||
end
|
||||
FixMacro(value)
|
||||
FixMacro(stinkies)
|
||||
end)
|
||||
|
||||
if Heimdall_Data.config.macroer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||
|
Reference in New Issue
Block a user