HolyLib:OnPhysicsLag
number HolyLib:OnPhysicsLag( number simulationTime, IPhysicsObject phys1, IPhysicsObject phys2, table recalcPhys, string callerFunction )
Description
Called when the physics simulaton is taking longer than the set lag threshold.
You can freeze all props here and then return physenv.IVP_SkipSimulation
to skip the simulation for this tick if someone is trying to crash the server.
Recently Changed
This was recently changed in version (0.8 - DEV).
The arguments phys1
, phys2
, recalcPhys
and callerFunction
were added
Arguments
4table recalcPhys
Table containing all physics object that are recalculating their collision rules.Don't modify them since it's highly unstable!
Returns
Example
Example usage of this hook
mainEnv:SetInSimulation(false) for _, v in ipairs(ents.GetAll()) do local phys = v:GetPhysicsObject() if phys:IsValid() and not recalcPhys[phys] then if phys:IsPenetrating() then v:SetCollisionGroup(COLLISION_GROUP_WORLD) end phys:EnableMotion(false) end end mainEnv:SetInSimulation(simulating) return physenv.IVP_SkipSimulation end)