HolyLib Wiki

HolyLib:PostEntityConstructor

 boolean HolyLib:PostEntityConstructor( string className )

Description

Called before CBaseEntity::PostConstructor is called.
This should allow you to set the EFL_SERVER_ONLY flag properly allowing you to create serverside-only entities.

Recently Changed

This was recently changed in version (0.8).

The arguments and return values were changed, the entity is no longer given since it was never valid, and the return value now decides if the entity becomes server-side only or not.

Arguments

1string className

The className of the Entity

Returns

1boolean becomeServerOnly = false

true to make the entity a serveronly entity

Example

Example usage of it for light entities possibly saving 1k edict slots for huge maps

hook.Add("HolyLib:PostEntityConstructor", "Example_ServerSide_Lights", function(class) if class == "light" then -- Return true makes these entities serverside only since they do not need networking at all -- This is because they use the lightstyle stringtable for networking / use the IVEngineServer::LightStyle binding return true end end)