From e98d5e166eef020a497e2d761d8a12eacc9ccc11 Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 3 Oct 2026 15:05:46 -0400 Subject: [PATCH] =?UTF-8?q?debug:=20OMNI-HACK=20tagcheck=20=E2=80=94=201s?= =?UTF-8?q?=20after=20each=20auto=20set=5Ftag,=20log=20whether=20the=20tag?= =?UTF-8?q?=20actually=20applied=20and=20whether=20skull=20entered=20hacki?= =?UTF-8?q?ng=20state=20(selection=20itself=20confirmed=20working:=2016=20?= =?UTF-8?q?picks=20incl=207m;=20skull=20only=20flies=20on-screen=20targets?= =?UTF-8?q?)=20+=20blacklist=20entries=20carry=20breed=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mods/AutoMark/mark/servo_skull_mark.lua | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua b/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua index c4f7bad..00ae824 100644 --- a/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua +++ b/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua @@ -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