Initial commit

This commit is contained in:
2026-03-15 14:54:49 +03:00
commit 64f8029c06
4027 changed files with 254888 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
local inext = ipairs( {} )
local EntityCache = nil
function ents.Iterator()
if ( EntityCache == nil ) then EntityCache = ents.GetAll() end
return inext, EntityCache, 0
end
local PlayerCache = nil
function player.Iterator()
if ( PlayerCache == nil ) then PlayerCache = player.GetAll() end
return inext, PlayerCache, 0
end
-- Called by the engine just before OnEntityCreated & just after EntityRemoved hooks
function InvalidateInternalEntityCache( isPly )
EntityCache = nil
if ( isPly ) then PlayerCache = nil end
end
local function InvalidateInternalEntityCacheOld( ent )
InvalidateInternalEntityCache( ent:IsPlayer() )
end
-- These are for non-updated servers
-- TODO: Remove me after update is released (past June 2025)
hook.Add( "OnEntityCreated", "ents.Iterator", InvalidateInternalEntityCacheOld )
hook.Add( "EntityRemoved", "ents.Iterator", InvalidateInternalEntityCacheOld )