diff --git a/AutoMark/scripts/mods/AutoMark/AutoMark_data.lua b/AutoMark/scripts/mods/AutoMark/AutoMark_data.lua index 4dc9524..9ddec6c 100644 --- a/AutoMark/scripts/mods/AutoMark/AutoMark_data.lua +++ b/AutoMark/scripts/mods/AutoMark/AutoMark_data.lua @@ -784,7 +784,7 @@ local widgets = { setting_id = "max_range", type = "numeric", default_value = 100, - range = { 1, 100 }, + range = { 1, 250 }, unit_text = "meter", decimals_number = 0 }, diff --git a/AutoMark/scripts/mods/AutoMark/mark/base_mark.lua b/AutoMark/scripts/mods/AutoMark/mark/base_mark.lua index 256a906..70028c2 100644 --- a/AutoMark/scripts/mods/AutoMark/mark/base_mark.lua +++ b/AutoMark/scripts/mods/AutoMark/mark/base_mark.lua @@ -124,6 +124,9 @@ function mod:set_manual_mark(tag_name, target_unit, target_tag) end end + if mod.ensure_automark_tag_hook then + mod:ensure_automark_tag_hook() + end smart_tag_system:set_tag(tag_name, player_unit, target_unit) end diff --git a/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua b/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua index 2311a55..9321672 100644 --- a/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua +++ b/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua @@ -43,39 +43,44 @@ local function ensure_automark_tag_hook() if type(orig_set_tag) ~= "function" then return end + -- GameParameters.testify short-circuits _tagger_is_looking_at_target (the dot-0.75 aim + -- cone + LOS sweep the game runs on host-side set_tag). Flipping it for the duration of + -- our own synchronous set_tag call keeps the ENTIRE vanilla chain alive (upstream's own + -- set_tag bookkeeping hook, group limits, template start(), rpc, telemetry) — earlier + -- attempts that replicated the accept-branch diverged from that bookkeeping, which is + -- why marking behaved so inconsistently. Auto-marking (set_auto_mark) creates tags + -- directly and never passes through here; this covers the servo-skull HACK orders only. + -- All other testify consumers are load-time UI requires / menu draw code that never + -- runs inside this window. local patched = {} patched.set_tag = function(self, template_name, tagger_unit, target_unit, target_location) - if self ~= smart_tag_system then - return orig_set_tag(self, template_name, tagger_unit, target_unit, target_location) - end - mod.omni_hack_hook_count = (mod.omni_hack_hook_count or 0) + 1 - if template_name == HACK_TAG_NAME and target_unit and self._is_server and not patched.in_branch then + if self == smart_tag_system and target_unit and self._is_server and not patched.in_branch and template_name == HACK_TAG_NAME then local target_extension = self._unit_extension_data[target_unit] if target_extension and target_extension._automark_hack_order then if mod_settings.debug_mode and not mod.omni_hack_hook_fired then mod.omni_hack_hook_fired = true - mod:diag("OMNI-HACK-DIAG hook FIRE is_server=", tostring(self._is_server)) + mod:diag("OMNI-HACK-DIAG hook FIRE (testify-bypass) template=", tostring(template_name)) end + mod.omni_hack_hook_count = (mod.omni_hack_hook_count or 0) + 1 + local saved_testify = GameParameters.testify patched.in_branch = true - local ok, err = pcall(function() - local tag_id = self:_generate_tag_id() - local tag = self:_create_tag_locally(tag_id, template_name, tagger_unit, target_unit, target_location) - self:_server_check_tag_group_limit(tagger_unit, tag:group()) - local template_name_id = NetworkLookup.smart_tag_templates[template_name] - local tagger_game_object_id = Managers.state.unit_spawner:game_object_id(tagger_unit) - local target_game_object_id = Managers.state.unit_spawner:game_object_id(target_unit) - Managers.state.game_session:send_rpc_clients("rpc_set_smart_tag", tag_id, template_name_id, tagger_game_object_id, target_game_object_id, nil, target_location) + local ok = pcall(function() + GameParameters.testify = true + orig_set_tag(self, template_name, tagger_unit, target_unit, target_location) end) + GameParameters.testify = saved_testify patched.in_branch = nil - if ok then + if not ok then + if mod_settings.debug_mode and not mod.omni_hack_taghook_err_logged then + mod.omni_hack_taghook_err_logged = true + mod:diag("OMNI-HACK-DIAG testify-bypass orig set_tag threw:", "see console") + end + else return end - if mod_settings.debug_mode and not mod.omni_hack_taghook_err_logged then - mod.omni_hack_taghook_err_logged = true - mod:diag("OMNI-HACK-DIAG tag-branch replication FAILED:", tostring(err)) - end end end + mod.omni_hack_hook_count = (mod.omni_hack_hook_count or 0) + 1 return orig_set_tag(self, template_name, tagger_unit, target_unit, target_location) end rawset(smart_tag_system, "set_tag", patched.set_tag) @@ -85,6 +90,7 @@ local function ensure_automark_tag_hook() mod:diag("OMNI-HACK-DIAG set_tag instance-shadow INSTALLED marker=", tostring(rawget(smart_tag_system, "set_tag") == patched.set_tag)) end end +mod.ensure_automark_tag_hook = ensure_automark_tag_hook local function servo_skull_mark_callback() local smart_tag_system = context.smart_tag_system