debug: hook wrapper stamp (marker field on fn) + unconditional fire-counter — engine stubs tostring(function) so pointer traces were blind; counters settle whether wrapper is on the call path at all

This commit is contained in:
2026-10-03 15:45:56 -04:00
parent c274d177ec
commit 1479b62a61
@@ -48,6 +48,7 @@ local function ensure_automark_tag_hook()
end end
if type(cls) == "table" and cls.set_tag ~= nil then 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: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 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 mod.omni_hack_hook_fired = true
local ext = target_unit and self._unit_extension_data[target_unit] local ext = target_unit and self._unit_extension_data[target_unit]
@@ -78,6 +79,9 @@ local function ensure_automark_tag_hook()
end) end)
mod.omni_hack_tag_hooked = true mod.omni_hack_tag_hooked = true
mod.omni_hack_hooked_ptr = tostring(cls.set_tag) 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 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)) 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 end
@@ -363,7 +367,7 @@ function mod:auto_hack(dt, t, fixed_frame)
if hack_check.ttl <= 0 then if hack_check.ttl <= 0 then
if mod_settings.debug_mode then if mod_settings.debug_mode then
local smart_tag_system = context.smart_tag_system 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 end
hack_check = nil hack_check = nil
end end
@@ -395,7 +399,11 @@ function mod:auto_hack(dt, t, fixed_frame)
end end
if mod_settings.debug_mode and not mod.omni_hack_ptr_logged then if mod_settings.debug_mode and not mod.omni_hack_ptr_logged then
mod.omni_hack_ptr_logged = true 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 end
local target_tag = smart_tag_system:unit_tag(target_unit) local target_tag = smart_tag_system:unit_tag(target_unit)