diff --git a/AutoMark/scripts/mods/AutoMark/AutoMark.lua b/AutoMark/scripts/mods/AutoMark/AutoMark.lua index b80aaad..797e4e8 100644 --- a/AutoMark/scripts/mods/AutoMark/AutoMark.lua +++ b/AutoMark/scripts/mods/AutoMark/AutoMark.lua @@ -545,6 +545,9 @@ local function auto_mark_by_tag(tag_name, t, fixed_frame) local smart_tag_system = context.smart_tag_system local player_unit = context.player and context.player.player_unit if smart_tag_system and player_unit then + if mod.log_action then + mod:log_action(string.format("CANCEL %s (dead)", mod:breed_name(marked_target))) + end mod:print_debug("Auto Mark target dead, releasing tag") smart_tag_system:cancel_tag(marked_tag._id, player_unit, true) marked_tag = nil diff --git a/AutoMark/scripts/mods/AutoMark/mark/base_mark.lua b/AutoMark/scripts/mods/AutoMark/mark/base_mark.lua index 70028c2..eed524b 100644 --- a/AutoMark/scripts/mods/AutoMark/mark/base_mark.lua +++ b/AutoMark/scripts/mods/AutoMark/mark/base_mark.lua @@ -45,6 +45,13 @@ function mod:cancel_mark(tag_id) return end + if mod.log_action then + local tag = smart_tag_system._all_tags and smart_tag_system._all_tags[tag_id] + if tag then + mod:log_action(string.format("CANCEL %s (mod)", mod:breed_name(tag._target_unit))) + end + end + local player = context.player local player_unit = player and player.player_unit if not player_unit then @@ -89,6 +96,9 @@ function mod:set_auto_mark(tag_name, target_unit, target_tag) end end + if mod.log_action then + mod:log_action(string.format("PING[%s] %s (%s)", tostring(tag_name), mod:breed_name(target_unit), tag_context.tag and "switch" or "new")) + end mod:print_debug("Auto Mark", tag_name, target_unit) on_set_tag(tag_context) local template_name_id = NetworkLookup.smart_tag_templates[tag_name] diff --git a/AutoMark/scripts/mods/AutoMark/ui/debug_hud.lua b/AutoMark/scripts/mods/AutoMark/ui/debug_hud.lua index 645cd0f..c3817f0 100644 --- a/AutoMark/scripts/mods/AutoMark/ui/debug_hud.lua +++ b/AutoMark/scripts/mods/AutoMark/ui/debug_hud.lua @@ -141,6 +141,16 @@ function mod:build_debug_hud_lines() end end + local ring = mod.action_log + if ring and #ring > 0 then + local now = mod:get_latest_fixed_time() + buf[#buf + 1] = "ACTIONS" + for i = math.max(1, #ring - 4), #ring do + local e = ring[i] + buf[#buf + 1] = string.format(" %4.1fs %s", now - e.t, e.s) + end + end + local confirm = mod.last_skull_confirm if confirm then buf[#buf + 1] = "SERVER last " .. tostring(confirm.n) .. ": " .. (confirm.accepted and "ACCEPTED" or "REJECTED") diff --git a/AutoMark/scripts/mods/AutoMark/utils/utils.lua b/AutoMark/scripts/mods/AutoMark/utils/utils.lua index 57ba503..c2e4ebd 100644 --- a/AutoMark/scripts/mods/AutoMark/utils/utils.lua +++ b/AutoMark/scripts/mods/AutoMark/utils/utils.lua @@ -31,6 +31,30 @@ function mod:get_gameplay_time() return Managers.time:time("gameplay") end +function mod:breed_name(unit) + if not unit then + return "?" + end + local ok, name = pcall(function() + local ext = ScriptUnit.extension(unit, "unit_data_system") + local breed = ext and ext._breed + return breed and breed.name or "?" + end) + return ok and name or "?" +end + +mod.action_log = {} +function mod:log_action(text) + if not (mod_settings.debug_hud or mod_settings.debug_mode) then + return + end + local ring = mod.action_log + ring[#ring + 1] = { t = FixedFrame.get_latest_fixed_time(), s = text } + if #ring > 40 then + table.remove(ring, 1) + end +end + function mod:get_latest_fixed_time() return FixedFrame.get_latest_fixed_time() end