zombiesurvival-evolved/gamemodes/zombiesurvival/gamemode/perf/shared/nixthelag.lua

48 lines
1.9 KiB
Lua
Raw Normal View History

2014-10-02 08:49:54 +08:00
-- Let's remove a bunch of expensive stuff that is never used.
hook.Add("Initialize", "NixTheLag", function()
-- Horrible amount of cycle usage, especially on the server.
hook.Remove("PlayerTick", "TickWidgets")
if SERVER then
-- Forget what this is but probably retarded.
if timer.Exists("CheckHookTimes") then
timer.Remove("CheckHookTimes")
end
end
if CLIENT then
-- These call on bloated convar getting methods and aren't ever used anyway outside of sandbox.
hook.Remove("RenderScreenspaceEffects", "RenderColorModify")
hook.Remove("RenderScreenspaceEffects", "RenderBloom")
hook.Remove("RenderScreenspaceEffects", "RenderToyTown")
hook.Remove("RenderScreenspaceEffects", "RenderTexturize")
hook.Remove("RenderScreenspaceEffects", "RenderSunbeams")
hook.Remove("RenderScreenspaceEffects", "RenderSobel")
hook.Remove("RenderScreenspaceEffects", "RenderSharpen")
hook.Remove("RenderScreenspaceEffects", "RenderMaterialOverlay")
hook.Remove("RenderScreenspaceEffects", "RenderMotionBlur")
hook.Remove("RenderScene", "RenderStereoscopy")
hook.Remove("RenderScene", "RenderSuperDoF")
hook.Remove("GUIMousePressed", "SuperDOFMouseDown")
hook.Remove("GUIMouseReleased", "SuperDOFMouseUp")
hook.Remove("PreventScreenClicks", "SuperDOFPreventClicks")
hook.Remove("PostRender", "RenderFrameBlend")
hook.Remove("PreRender", "PreRenderFrameBlend")
hook.Remove("Think", "DOFThink")
hook.Remove("RenderScreenspaceEffects", "RenderBokeh")
hook.Remove("NeedsDepthPass", "NeedsDepthPass_Bokeh")
-- Useless since we disabled widgets above.
hook.Remove("PostDrawEffects", "RenderWidgets")
-- Could screw with people's point shops but whatever.
hook.Remove("PostDrawEffects", "RenderHalos")
end
end)
-- This probably chops off a few FPS (1 to 5) but stops many problems with frame spikes.
--[[hook.Add("Think", "ManualGC", function()
collectgarbage("step", 192)
end)]]