Lethal Company
You are viewing a potentially older version of this package. View Latest Version
Install with App

Details

Date Uploaded
Downloads
249
Size
51KB

ModpackFixes

Lightweight, modular compatibility and bugfix patches for Lethal Company (v81) modpacks.

ModpackFixes is designed for players who share and maintain multiple r2modman / Gale / Thunderstore modpack profiles:

  • Zero forced mod dependencies: Third-party mods are detected dynamically at runtime via BepInEx.Bootstrap.Chainloader and patched via reflection + Harmony. Adding Aqlow-ModpackFixes to an exported profile will never force-install mods you removed in another profile.
  • Per-fix toggles: Every compatibility module has its own [Fixes] toggle in BepInEx/config/dev.aqlow.modpackfixes.cfg (enabled by default).
  • Safe when target mods are absent: Modules whose target mods aren't installed automatically skip startup cleanly with a single log line.

Included Fixes (0.2.0)

1. Built-In Orbit & Mid-Round Late Join (LateJoinFix)

  • Config keys: [Fixes] LateJoinFix = true, [LateJoin] AllowJoiningWhileLanded = true
  • Activates when: Always (compatible with vanilla 4-player lobbies and MoreCompany 32-player lobbies)
  • What it provides & fixes:
    • Keeps lobbies joinable in orbit and (when AllowJoiningWhileLanded = true) after the ship has finished landing, while blocking joins during dungeon generation and ship takeoff/scene unload.
    • Fixes vanilla's two StartOfRound.OnPlayerConnectedClientRpc bugs: reconciles all 0..N-1 MoreCompany slots via connectedPlayerIdsOrdered (not just j < connectedPlayersAmount + 1), preserves isPlayerDead = true / isPlayerControlled = false on already-dead players, computes authoritative livingPlayers, and assigns localPlayerController on the joining client immediately before GenerateNewLevelClientRpc runs.
    • Sends an authoritative CustomMessagingManager snapshot (dev.aqlow.modpackfixes.latejoin_sync) syncing per-slot life/suits/names/locations, mid-round level seed, weather, mold state, breaker power, TimeOfDay clock, ship doors, occupied InteractTriggers / Terminal lock state, and dead-player spectator voice muting.
    • Cleans up disconnected players non-destructively in StartOfRound.OnPlayerDC (releasing held InteractTrigger / Terminal locks, resetting slot names/radar labels, and triggering automatic ship leave if the last living player disconnects on a moon).

2. Netcode Mid-Round Scene Sync & Approval Retry Guard (NgoSceneSyncNullParentFix)

  • Config key: [Fixes] NgoSceneSyncNullParentFix = true
  • Activates when: Always
  • Fix: Replaces Unity.Netcode.SceneEventData.SortChildrenNetworkObjects with a Unity Object != null-aware comparator so destroyed cached parent transforms never crash SynchronizeNetworkObjects during mid-round joins, and makes NetworkConnectionManager.AddClient idempotent if a clientId already exists from an earlier pending approval retry.

3. Deterministic Player & Radar Target Name Sync (RadarTargetNameSyncFix)

  • Config key: [Fixes] RadarTargetNameSyncFix = true
  • Activates when: Always
  • Fix: Fixes vanilla's duplicate-name numbering in SendNewPlayerValuesClientRpc across all slots, synchronizes playerUsername + usernameBillboardText + QuickMenu labels, and updates StartOfRound.Instance.mapScreen via ChangeNameOfTargetTransform(player.transform, ...) (plus SyncOrderOfRadarBoostersInList) so non-player RadarBooster entries never shift player names out of sync with darmuhsTerminalStuff or OpenBodyCams.

4. Interaction Lock & Item Slot Safety (InteractionLockSafetyFix)

  • Config key: [Fixes] InteractionLockSafetyFix = true
  • Activates when: Always (with optional soft-patch when mrgrm7.LethalCasino is loaded)
  • Fix: Repairs null localPlayerController before InteractTrigger.StopSpecialAnimation, automatically releases manual-stop InteractTrigger locks orphaned by dead or disconnected players without disturbing active remote Terminal users, and guards LethalCasino.Patches.PlayerControllerBPatch.ShowScrapValueHoverTip when currentItemSlot is outside 0 .. ItemSlots.Length - 1 (e.g., LevelDown carry slot 50).

5. Biodiversity Boom Bird + Bigger Ships Compatibility (EnableBoomBirdBiggerShipFix)

  • Config key: [Fixes] EnableBoomBirdBiggerShipFix = true
  • Activates when: Biodiversity (com.github.biodiversitylc.Biodiversity) is loaded; exterior-perch routing engages automatically when mborsh.WiderShipMod, MelanieMelicious.2StoryShip, any configured MicBird compat mod is present, or shipBounds.bounds.size exceeds vanilla dimensions
  • Problem: Boom Birds (MicBirdAI) target middleOfShipNode + (0, 4, 0) (buried inside 2-story/wider ship cabins) or unverified ±15m forward offsets inside carved ship NavMesh, causing !agent.hasPath for 10 AI ticks and silent early suicide despawns (Playing death sound for enemy: Boom bird) that also leak enemyType.numberSpawned and leave firstSpawned stuck on a dead bird. In addition, ToggleAllWalkiesOutsideClientRpc uses if (w.isInFactory) break;, aborting before outdoor/ship walkies whenever an indoor walkie sits earlier in walkies.
  • Fix: Computes NavMesh-sampled, PathComplete-verified exterior perimeter perch positions outside enlarged shipBounds, warps off-NavMesh reinforcement spawns onto nearby walkable NavMesh, promotes a living leader when firstSpawned dies/despawns, decrements numberSpawned on despawnEarly, resets static state each round, and orders !isInFactory walkies first in Update without touching RPC execution stages.

6. DawnLib + Mirage Cloned EnemyType DawnEnemyInfo Repair

  • Config key: [Fixes] CopyDawnInfoToClonedEnemyTypes = true
  • Activates when: TeamXiaolan-DawnLib (com.github.teamxiaolan.dawnlib) is loaded
  • Problem: DawnLib injects IDawnObject.DawnInfo (DawnEnemyInfo) onto canonical EnemyType assets during registry freeze. When Mirage (qwbarch-Mirage) has masked enemy spawn control enabled on the host, it calls UnityEngine.Object.Instantiate<EnemyType>(maskedPrefab.enemyType) inside On.TimeOfDay.Start to inject MaskedPlayerEnemy(Clone) across moons. Unity's Object.Instantiate leaves the injected managed DawnInfo backing field null on the clone, causing NullReferenceException in mods that inspect SelectableLevel.Enemies via EnemyType.GetDawnInfo().
  • Fix: Automatically copies DawnEnemyInfo onto any cloned EnemyType whose DawnInfo is null (resolving the canonical donor via enemyPrefab -> EnemyAI.enemyType, with a fallback lookup across loaded EnemyType assets) after TimeOfDay.Start, before RoundManager.LoadNewLevel, and before RoundManager.BeginEnemySpawning.

7. FacilityMeltdown Host Ship Auto-Takeoff Desync Guard

  • Config key: [Fixes] GuardFacilityMeltdownHandleEnemies = true
  • Activates when: loaforc-FacilityMeltdown (me.loaforc.facilitymeltdown) is loaded
  • Problem: In FacilityMeltdown, MeltdownHandler.StartMeltdownClientRpc() calls HandleEnemies() on the server before setting meltdownStarted = true. When HandleEnemies() encounters an EnemyType missing DawnEnemyInfo (such as Mirage's MaskedPlayerEnemy(Clone)), it logs a warning without continuing and throws NullReferenceException on the host before meltdownStarted = true. Non-host clients tick down meltdownTimer and see the ship take off automatically, while the host's MeltdownHandler.Update() returns early forever until the ship lever is pulled manually.
  • Fix: Runs DawnEnemyInfo clone repair immediately before MeltdownHandler.HandleEnemies() executes and wraps HandleEnemies() with a Harmony Finalizer safety net so an enemy-spawning error can never abort StartMeltdownClientRpc() before meltdownStarted = true on the host.

Requirements & Installation

  • Lethal Company: Tested on v81
  • Mod Loader: BepInEx-BepInExPack-5.4.2304
  • Multiplayer Compatibility: Safe on both host and clients (recommended on at least the host; installs cleanly for everyone in shared r2modman profile codes).

Install

Install Aqlow-ModpackFixes via r2modman, Gale, or the Thunderstore Mod Manager, or extract plugins/ModpackFixes.dll into BepInEx/plugins/Aqlow-ModpackFixes/.

Uninstall & Troubleshooting

Remove the package in your mod manager (or delete BepInEx/plugins/Aqlow-ModpackFixes/). Startup activation and skip logs are written to BepInEx/LogOutput.log under [Info :ModpackFixes].


Credits & Disclosure

  • Built for Lethal Company using BepInEx 5 and HarmonyX.
  • Compatibility research against TeamXiaolan-DawnLib, qwbarch-Mirage, loaforc-FacilityMeltdown, me.swipez.melonloader.morecompany, mrgrm7.LethalCasino, Biodiversity, mborsh.WiderShipMod, and MelanieMelicious.2StoryShip.
  • AI Disclosure: Code, automated tests, and procedural package icon authored with GitHub Copilot (Gemini 4 Carbon).
  • License: MIT.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.