From 32994520bb6893bd3f4a77544cdc57909d57fe9c Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 3 Oct 2026 07:24:54 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20auto-hack=20is=20360-aware=20=E2=80=94?= =?UTF-8?q?=20with=20omni=5Fmark=20on,=20pick=20nearest=20hackable=20unit?= =?UTF-8?q?=20from=20smart-tag=20registry=20instead=20of=20crosshair-scope?= =?UTF-8?q?d=20HUD=20markers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mods/AutoMark/mark/servo_skull_mark.lua | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua b/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua index 0097d75..c603f1e 100644 --- a/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua +++ b/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua @@ -21,6 +21,9 @@ local Managers = Managers local callback = callback local get_game_object_field = GameSession.game_object_field local ScriptUnit_extension = ScriptUnit.extension +local HEALTH_ALIVE = HEALTH_ALIVE +local Unit_world_position = Unit.world_position +local Vector3_distance = Vector3.distance local HACK_TAG_NAME = "hacking_over_here_companion" local CANCEL_INTERVAL = 0.5 @@ -214,6 +217,30 @@ local find_hackable_target_unit = function() return selected_marker_unit, selected_marker_distance end +local function find_hackable_target_unit_omni() + local smart_tag_system = context.smart_tag_system + local player = context.player + local player_unit = player and player.player_unit + if not smart_tag_system or not player_unit then + return + end + + local player_position = Unit_world_position(player_unit, 1) + local selected_unit, selected_distance + 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 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 + selected_unit, selected_distance = unit, distance + end + end + end + end + return selected_unit, selected_distance +end + local hack_interval = 0 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 @@ -240,7 +267,7 @@ function mod:auto_hack(dt, t, fixed_frame) return end - local target_unit, _ = find_hackable_target_unit() + local target_unit, _ = mod_settings.omni_mark and find_hackable_target_unit_omni() or find_hackable_target_unit() if not target_unit then return end