From f41ef1793e21403d713d38ff9c2e0cc0fa6d7364 Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 3 Oct 2026 14:07:05 -0400 Subject: [PATCH] =?UTF-8?q?debug:=20OMNI-HACK-DIAG=20probe=20=E2=80=94=20d?= =?UTF-8?q?ump=20hack-tag=20template=20fields=20+=20hackable-vs-total=20un?= =?UTF-8?q?it=20counts=20(debug=5Fmode-gated)=20to=20locate=20why=20omni?= =?UTF-8?q?=20auto-hack=20doesn't=20fire=20off-LOS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mods/AutoMark/mark/servo_skull_mark.lua | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua b/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua index c603f1e..2c93549 100644 --- a/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua +++ b/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua @@ -225,11 +225,55 @@ local function find_hackable_target_unit_omni() return end + if mod_settings.debug_mode and not mod.omni_hack_template_logged then + mod.omni_hack_template_logged = true + local templates = smart_tag_system._templates or smart_tag_system._tag_templates + if templates and type(templates) == "table" then + local tpl = templates[HACK_TAG_NAME] + if type(tpl) == "table" then + local parts = {} + for k, v in pairs(tpl) do + local vs + if type(v) == "table" then + local inner = {} + for k2, v2 in pairs(v) do + inner[#inner + 1] = tostring(k2) .. "=" .. tostring(v2) + end + vs = "{" .. table.concat(inner, ",") .. "}" + else + vs = tostring(v) + end + parts[#parts + 1] = tostring(k) .. "=" .. vs + end + mod:info("OMNI-HACK-DIAG template: " .. table.concat(parts, " ")) + else + mod:info("OMNI-HACK-DIAG template missing: " .. tostring(tpl)) + end + else + local keys = {} + for k in pairs(smart_tag_system) do + keys[#keys + 1] = tostring(k) + end + table.sort(keys) + mod:info("OMNI-HACK-DIAG no templates table, system keys: " .. table.concat(keys, ",")) + end + end + local player_position = Unit_world_position(player_unit, 1) local selected_unit, selected_distance + local diag_total, diag_hackable + if mod_settings.debug_mode then + diag_total, diag_hackable = 0, 0 + end for unit, target_extension in pairs(smart_tag_system._unit_extension_data) do if unit ~= player_unit and HEALTH_ALIVE[unit] and target_extension._target_type == "breed" then local template_name = target_extension:_contextual_tag_template_name(player_unit, "companion_order") + if diag_total then + diag_total = diag_total + 1 + if template_name == HACK_TAG_NAME then + diag_hackable = diag_hackable + 1 + end + end if template_name == HACK_TAG_NAME then local distance = Vector3_distance(Unit_world_position(unit, 1), player_position) if not selected_distance or distance < selected_distance then @@ -238,6 +282,12 @@ local function find_hackable_target_unit_omni() end end end + if diag_total then + mod.omni_hack_diag_counter = (mod.omni_hack_diag_counter or 0) + 1 + if mod.omni_hack_diag_counter % 10 == 1 then + mod:info(string.format("OMNI-HACK-DIAG breed_units=%d hackable=%d selected=%s dist=%s", diag_total, diag_hackable, tostring(selected_unit), tostring(selected_distance))) + end + end return selected_unit, selected_distance end