NutcrackerFixes
Overview
Lethal Company mod that patches components for the Nutcracker and Shotgun item to reduce lag spikes and non-registering shots.
Specific Changes
- Patch Shotgun hit registration to make it more consistent.
- The SphereCastNonAlloc() used to check for hits on monsters has an undefined order for its resulting hit list, but the existing code seemed to assume that it was ordered from closest to farthest. The hit registration would bail out under some conditions, causing shots not to hit if a hit was obstucted by a wall, entity behind the player, or a non-enemy collider.
- The array used to get the hits was limited to 10 elements, but more colliders will sometimes be present, and cause the cast to miss the actual target the Shotgun is aimed at. This especially tended to happen when blobs with their many colliders were present.
- Any duplicate hits to the same enemy will now be ignored. This shouldn't change behavior for damageable enemies, but will avoid spawning tens of sound effects for each blob hit by a shot, which significantly reduces stuttering when shooting nearby to a blob.
- Remove debug spam from the Nutcracker and Shotgun. These would cause lower frame rates and even stutters.
- Prevent a NullReferenceException when a Nutcracker would shoot a Blob. The Blob AI assumed that only players could hit it, but now that is no longer the case.