Excessive ragdolling
Posted: Tue Jun 04, 2013 6:36 pm
Ragdoll physics can be a lot of fun, but lately they have been abused and spammed resulting in server crashes. Can we have a rule against this?
We are a forum for people who lean out of the norm. Remember: Autistics and Aspies are welcome here! Also, we run gameservers!
https://fadw.net/forums/
Code: Select all
-- The only truly effective way to prevent all kinds of velocity and
-- inertia is motion disabling the entire ragdoll for a tick
-- for non-ragdolls this will do the same for their single physobj
hook.Add("Think","AMB_CrashCatcher",function()
for k, ent in pairs(ents.FindByClass("prop_ragdoll")) do
if IsValid(ent) then
if ent.player_ragdoll then
if ent:GetVelocity( ):Length() >= 1500 then
for i=0, ent:GetPhysicsObjectCount()-1 do
local subphys = ent:GetPhysicsObjectNum(i)
if IsValid(subphys) then
subphys:EnableMotion(false)
end
end
ServerLog("[!CRASHCATCHER!] Caught velocity > 1500 on a ragdoll entity, negating velocity and temporarily disabling motion.\n")
timer.Create( "AMB_ReEnable_Motion", 2.5, 1, function()
if IsValid(subphys) then
subphys:Wake()
end
end)
end
end
end
end
end)