Entity Crash Catcher

Entity Crash Catcher v2

This script detects entities that are moving too fast, leading to a potential server crash.

Make sure to configure the convars in the script to best fit your server.

Convars

  • gs_crazyphysics (default “1”): Enables Lua crazyphysics detection
  • gs_crazyphysics_echo (default “0”): Inform players of ragdoll freezing/removal
  • gs_crazyphysics_interval (default “0.1”): How often to check entities for extreme velocity
  • gs_crazyphysics_speed_defuse (default “4000”): Max velocity in in/s an entity can reach before it’s frozen
  • gs_crazyphysics_speed_remove (default “6000”): Max velocity in in/s an entity can reach before it’s removed
  • gs_crazyphysics_defusetime (default “1”): How long to freeze the entity for during diffusal

By default, the script only checks prop_ragdoll entities. To add more entity classes, add an entry to the tEntitiesToCheck table. tIdentifyEntities is the table of entities to run through TTT’s identification process.

Authors

  • code_gs - v2 creator and current maintainer
  • Ambro - Original creator of script and concept
  • DarthTealc - Added TTT support
  • TheEMP - Fixed TTT body identification
  • LuaTenshi - Better TTT check and misc fixes

GitHub: https://github.com/Kefta/gs_crazyphysics

From reading the code through this will only work on TTT. The code will stop because ent.player_ragdoll is only really used in TTT - that and you’re running functions that won’t exist out of the gamemode such as CORPSE.GetFound(). So this script is great for TTT but will most likely not do anything in other gamemodes.

The only thing that won’t work is the body identifier, which can be deleted. This was just adapted for TTT since it most commonly occurs in there. This could be adapted for props, however, as many people have been reporting crashes due to props going too fast in gamemodes such as DarkRP.

Still usefull, i probably can enable ragdolled on darkrp now due to this script.

Why would you want to allow people to spawn ragdolls in DarkRP, anyways?

One Question: I have this on my server because it crashed several times because of heavy ragdolls. It fixed it but ONLY my corpse gets always removed and this is really annoying because nobody can identifie my corpse.
EDIT: I’ts probably because of the playermodel and now every corpse from anyone gets removed because I set a custom playermodel for every player.

you can up the remove speed slightly and it should still work properly.

I haven’t had this issue for over 6 months now. (or any crash really) I moved to linux hosting and it’s been smooth sailing.

This bug did use to piss me off though, a quick workaround for it was to set the mass on bodies over a certain velocity then ‘statue’ them for a split second (which wasn’t even noticeable), after this, apply the same velocity to the body (and it’s bones) to keep it looking realistic (capped max of course). Got all their giblets back where they should be, which if i’m not wrong, is what caused the crashes in the first place.

What do you guys recommend me to set the remove speed to?

Around 9000 was good for me and between 5000-6000 for freeze, best combo Ifink.

But isn’t that harder than before? I thought I should make the rate lower and not higher?!

Higher the number the faster the ragdoll is moving. What I said is fine for preventing crashes whilst keeping gameplay laregly unaffected.

Alright thanks.

Code now supports all gamemodes and is much more efficient now.

Also, bodies identify when being removed on TTT.

I hit this error:


[ERROR] lua/autorun/ragdoll_fix.lua:27: attempt to call global 'KillVelocity' (a nil value)
  1. fn - lua/autorun/ragdoll_fix.lua:27
   2. unknown - addons/ulib/lua/ulib/shared/hook.lua:183

Fixed; silly function order mistake.

Maybe I’m wrong, but line 80 seems to have a ‘)’ too much?

No?


[ERROR] lua/autorun/server/crashfix.lua:80: unexpected symbol near ')'
1. unknown - lua/autorun/server/crashfix.lua:0

(Taken from your github page)

You still have the outdated code.