diff --git a/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua b/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua index 581803d..097791a 100644 --- a/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua +++ b/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua @@ -48,6 +48,7 @@ local function ensure_automark_tag_hook() end if type(cls) == "table" and cls.set_tag ~= nil then mod:hook(cls, "set_tag", function(previous_hook, self, template_name, tagger_unit, target_unit, target_location) + mod.omni_hack_hook_count = (mod.omni_hack_hook_count or 0) + 1 if template_name == HACK_TAG_NAME and mod_settings.debug_mode and not mod.omni_hack_hook_fired then mod.omni_hack_hook_fired = true local ext = target_unit and self._unit_extension_data[target_unit] @@ -78,6 +79,9 @@ local function ensure_automark_tag_hook() end) mod.omni_hack_tag_hooked = true mod.omni_hack_hooked_ptr = tostring(cls.set_tag) + pcall(function() + cls.set_tag.omni_hook_marker = true + end) if mod_settings.debug_mode then mod:diag("OMNI-HACK-DIAG set_tag hook INSTALLED cls_ptr=", tostring(cls.set_tag), " sys_ptr=", tostring(smart_tag_system.set_tag), " same_sys_obj=", tostring(smart_tag_system == context.smart_tag_system)) end @@ -363,7 +367,7 @@ function mod:auto_hack(dt, t, fixed_frame) 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 hooked=%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()), tostring(mod.omni_hack_tag_hooked))) + mod:diag(string.format("OMNI-HACK-DIAG tagcheck %s alive=%s tag_applied=%s skull_hacking=%s hooked=%s hookcalls=%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()), tostring(mod.omni_hack_tag_hooked), tostring(mod.omni_hack_hook_count))) end hack_check = nil end @@ -395,7 +399,11 @@ function mod:auto_hack(dt, t, fixed_frame) end if mod_settings.debug_mode and not mod.omni_hack_ptr_logged then mod.omni_hack_ptr_logged = true - mod:diag("OMNI-HACK-DIAG call-site sys_ptr=", tostring(smart_tag_system.set_tag), " hooked_ptr=", tostring(mod.omni_hack_hooked_ptr)) + local marker + pcall(function() + marker = smart_tag_system.set_tag.omni_hook_marker + end) + mod:diag("OMNI-HACK-DIAG call-site marker_on_calling_fn=", tostring(marker), " hook_calls_before_this=", tostring(mod.omni_hack_hook_count)) end local target_tag = smart_tag_system:unit_tag(target_unit)