You are viewing a potentially older version of this package. View all versions.
Zaggy1024-NutcrackerFixes-1.2.2 icon

NutcrackerFixes

Lethal Company mod that patches components for the Nutcracker and Shotgun item to reduce lag spikes and non-registering shots.

Date uploaded 5 months ago
Version 1.2.2
Download link Zaggy1024-NutcrackerFixes-1.2.2.zip
Downloads 121881
Dependency string Zaggy1024-NutcrackerFixes-1.2.2

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

NutcrackerFixes

Overview

Lethal Company mod that patches the Nutcracker and Shotgun item to reduce the occurrence of lag spikes and non-registering shots.

Specific Changes

  • Patched the Shotgun hit registration to make it more consistent.
    • The hit registration would bail out if some conditions for dealing damage failed. If the shot was obstructed, the shot's sphere cast started inside an enemy's hitbox, or if it hit a non-enemy collider, then all other hits after that would be skipped, causing some non-registering shots. With this mod, the subsequent hits will still be processed.
    • The array used to get the hits was limited to 10 elements, but blobs can cause many more colliders to be present, meaning that shooting nearby to a blob could cause a non-registering hit. With this mod, the size of that array is increased to 50, which appears to work even in cases where multiple blobs are present.
    • To avoid unnecessary work when shooting nearby to blobs or any other enemies with multiple colliders, the hit registration will ensure that it only applies a hit to an enemy once. This should have no effect on damage dealt to enemies that actually receive damage from the Shotgun.
  • Removed some debug logging from the Nutcracker which would be spammed constantly from the Update() function.
  • Prevented NullReferenceExceptions when a Nutcrackers shoot Blobs or Spiders. Both AI scripts assumed that only players could hit them, which would cause a long stutter when a Nutcracker hits either enemy.
  • An optional opt-out feature aims to prevent desync of the number of shells loaded into shotguns as well as their safety setting. Without this enabled, having more than 250 items on the ship will usually cause shotguns to spawn on clients with the safety off and only one shell chambered.

CHANGELOG

Version 1.2.2

  • Updating readme and changelog since I accidentally bumped the version two minor versions instead of one...

Version 1.2.1

  • Removed some leftover debug code.

Version 1.2.0

  • Added an opt-out feature to help ensure that shotguns stay synchronized.
    • When a client picks up a shotgun, the number of shells loaded as well as the current safety setting will be synchronized. This prevents an issue where having too many items on the ship would cause the safety and shell count to be desynced.
    • The safety setting will also be synchronized to all clients when it is changed to ensure that it doesn't remain desynced if anything changes the safety unexpectedly.

Version 1.0.1

  • Disabled logging in the shotgun hitreg loop

Version 1.0.0

  • Fixed stutters on nutcrackers shooting other monsters
  • Improved shotgun hit registration to avoid non-registering shots