This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- What this file does: | |
-- Removes the need to util.AddNetworkString() for net messages | |
-- It will be added automatically when the server does net.Receive or net.Start with it the first time | |
-- Optimizes net.Incoming by caching all receivers at the network id | |
-- The lookup basically changes from Receivers[string.lower(util.NetworkIDToString(id))] to Receivers[id] | |
local NetworkStringToIDCache = {} | |
-- Faster than util.NetworkStringToID, returns nil if missing on client, added automatically if missing on server | |
local function NetworkStringToID(str) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Mostly-fix for https://github.com/Facepunch/garrysmod-issues/issues/3362 and 4953 | |
-- This won't well if you're trying to set material overrides on the same entity on both the server and client. | |
-- Also calling SetMaterial() or SetSubMaterial() will reset both materials and submaterials. | |
-- Put this in lua/autorun/client/materialfix.lua | |
-- A set of entities which have appeared recently and have clientside material overrides | |
local watchlist = {} | |
-- It seems to take about 5 ticks/0.2 sec from when the entity enters PVS to | |
-- when it reapplies its server material setting (but the time is inconsistent) |