Files
ViewpointTurrets/42.20/media/lua/client/ZZ_MTKViewpointProjectiles.lua
T
2026-10-27 17:16:21 -04:00

26 lines
1.1 KiB
Lua

-- Replace only MTK's tracer UI callback. Its physics, hits, ammunition and
-- VisualProjectilePC lifecycle stay owned by the original mod.
local legacy, replacement
local function install()
local bridge = MTKViewpointProjectiles
if not bridge or not VisualProjectilePC then return end
if not bridge.bind(VisualProjectilePC.removeByID, VisualProjectilePC.list) then
print("[MTKViewpointTurrets] MTK projectile API differs; original drawing retained.")
return
end
if replacement then return end
legacy = bridge.legacyRenderer()
if not legacy then
print("[MTKViewpointTurrets] MTK tracer callback not identified; original drawing retained.")
return
end
replacement = function()
if not MTKViewpointCamera or not MTKViewpointCamera.enabled() then return legacy() end
end
Events.OnPreUIDraw.Remove(legacy)
Events.OnPreUIDraw.Add(replacement)
print("[MTKViewpointTurrets] 3D projectile renderer registered; isometric tracers retained in iso view.")
end
Events.OnGameBoot.Add(install)
Events.OnGameStart.Add(install)