debug: OMNI-HACK-DIAG probe — dump hack-tag template fields + hackable-vs-total unit counts (debug_mode-gated) to locate why omni auto-hack doesn't fire off-LOS
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user