feat: server-side rpc_request_set_smart_tag shadow — flip testify around the request handler so client auto-mark requests stop dying in the server's aim-cone/LOS re-check at packet arrival (OMNI-CONFIRM measured 34% silent rejects, heaviest on ranged breeds); armed from SmartTagSystem:update hook_safe so it installs in the server state too (client ticks never run there); OMNI-BOOT probe proves whether/where mod code executes

This commit is contained in:
2026-10-04 08:49:20 -04:00
parent 28c653428d
commit a75ae3492c
@@ -36,7 +36,48 @@ local CANCEL_INTERVAL = 0.5
-- (_generate_tag_id -> _create_tag_locally -> group limit -> rpc to clients) minus the gate.
local function ensure_automark_tag_hook()
local smart_tag_system = context.smart_tag_system
if not smart_tag_system or mod.omni_hack_patched_sys == smart_tag_system then
if not smart_tag_system then
return
end
if smart_tag_system._is_server then
if mod.omni_rpc_patched_sys == smart_tag_system then
return
end
local orig_rpc = smart_tag_system.rpc_request_set_smart_tag
if type(orig_rpc) ~= "function" then
return
end
-- SERVER STATE: clients' mark requests land here and die in _tagger_is_looking_at_target
-- (OMNI-CONFIRM measured 34% of outgoing auto-mark requests silently rejected: the server
-- re-checks aim cone + LOS at packet-arrival time, by which time the player has turned).
-- Rawset-shadow the handler on this instance and flip GameParameters.testify around the
-- synchronous original call so the look-check short-circuits; everything else in the
-- handler (templates, group limits, start(), rpc broadcast, telemetry) runs untouched.
-- Other testify consumers (dialogue, backend, talent, triggers) do not execute inside
-- this synchronous window.
local patched_rpc = function(self, channel_id, template_name_id, ...)
if mod_settings.debug_mode and not mod.omni_rpc_shadow_fired then
mod.omni_rpc_shadow_fired = true
mod:diag("OMNI-RPC-SHADOW FIRE (server-side testify window)")
end
local target_game_object_id, target_level_index, target_location = ...
local saved_testify = GameParameters.testify
GameParameters.testify = true
local ok = pcall(function()
orig_rpc(self, channel_id, template_name_id, target_game_object_id, target_level_index, target_location)
end)
GameParameters.testify = saved_testify
if not ok and mod_settings.debug_mode and not mod.omni_rpc_shadow_err_logged then
mod.omni_rpc_shadow_err_logged = true
mod:diag("OMNI-RPC-SHADOW orig handler threw")
end
end
rawset(smart_tag_system, "rpc_request_set_smart_tag", patched_rpc)
mod.omni_rpc_patched_sys = smart_tag_system
mod:diag("OMNI-RPC-SHADOW INSTALLED on server-state system")
return
end
if mod.omni_hack_patched_sys == smart_tag_system then
return
end
local orig_set_tag = smart_tag_system.set_tag
@@ -97,6 +138,17 @@ local function ensure_automark_tag_hook()
end
mod.ensure_automark_tag_hook = ensure_automark_tag_hook
-- the server-side state never runs our auto_hack/mark ticks (no local player), so arm the
-- rpc-handler shadow from the tag system's own per-frame update, which runs in every state.
mod:hook_safe(CLASS.SmartTagSystem, "update",
function(self, ...)
if not mod.omni_update_hook_seen then
mod.omni_update_hook_seen = true
mod:diag("OMNI-BOOT smart_tag_system:update seen, is_server=", tostring(self._is_server), " ctx_same=", tostring(self == context.smart_tag_system))
end
ensure_automark_tag_hook()
end)
local function servo_skull_mark_callback()
local smart_tag_system = context.smart_tag_system
if not smart_tag_system then