debug: OMNI-HACK tagcheck — 1s after each auto set_tag, log whether the tag actually applied and whether skull entered hacking state (selection itself confirmed working: 16 picks incl 7m; skull only flies on-screen targets) + blacklist entries carry breed name

This commit is contained in:
2026-10-03 15:05:46 -04:00
parent 15994ed04e
commit e98d5e166e
@@ -235,7 +235,7 @@ local function find_hackable_target_unit_omni()
end
local player_position = Unit_world_position(player_unit, 1)
local selected_unit, selected_distance
local selected_unit, selected_distance, selected_name
local diag_total
if mod_settings.debug_mode then
diag_total = 0
@@ -255,6 +255,9 @@ local function find_hackable_target_unit_omni()
end
if distance <= OMNI_HACK_RANGE and (not selected_distance or distance < selected_distance) then
selected_unit, selected_distance = unit, distance
if diag_samples then
selected_name = breed_data.name
end
end
end
end
@@ -270,31 +273,41 @@ local function find_hackable_target_unit_omni()
end
if selected_unit then
-- don't retarget the same unit forever if the game refuses to accept the tag
mod._hack_blacklist[selected_unit] = HACK_RETRY_DELAY
mod._hack_blacklist[selected_unit] = { t = HACK_RETRY_DELAY, n = selected_name }
end
return selected_unit, selected_distance
end
local hack_interval = 0
local hack_check = nil
function mod:auto_hack(dt, t, fixed_frame)
if not mod_settings.auto_hack or (mod_settings.disable_auto_hack_for_noospheric_command and context.has_noospheric_command) or context.class_name ~= "cryptic" or not context.has_servo_skull then
return
end
for unit, entry in pairs(mod._hack_blacklist) do
entry.t = entry.t - dt
if entry.t <= 0 then
mod._hack_blacklist[unit] = nil
end
end
if hack_check then
hack_check.ttl = hack_check.ttl - dt
if hack_check.ttl <= 0 then
if mod_settings.debug_mode then
local smart_tag_system = context.smart_tag_system
mod:diag(string.format("OMNI-HACK-DIAG tagcheck %s alive=%s tag_applied=%s skull_hacking=%s", tostring(hack_check.n), tostring(HEALTH_ALIVE[hack_check.unit] == true), tostring(smart_tag_system and smart_tag_system:unit_tag(hack_check.unit) ~= nil), tostring(mod:is_servo_skull_hacking())))
end
hack_check = nil
end
end
if hack_interval > 0 then
hack_interval = hack_interval - dt
return
end
for unit, remaining in pairs(mod._hack_blacklist) do
local age = remaining - dt
if age <= 0 then
mod._hack_blacklist[unit] = nil
else
mod._hack_blacklist[unit] = age
end
end
if mod:is_servo_skull_hacking() then
return
end
@@ -324,6 +337,7 @@ function mod:auto_hack(dt, t, fixed_frame)
hack_interval = 1
smart_tag_system:set_tag(HACK_TAG_NAME, player_unit, target_unit)
hack_check = { unit = target_unit, ttl = 1.0, n = mod._hack_blacklist[target_unit] and mod._hack_blacklist[target_unit].n or "?" }
end
local cancel_interval = 0