Aqlow-ModpackFixes icon

ModpackFixes

Lightweight modular compatibility and bugfix patches for Lethal Company v81 modpacks, with soft-dependency detection so profile exports never force optional mods.

Last updated 17 minutes ago
Total downloads 0
Total rating 0 
Categories Bug Fixes AI Generated
Dependency string Aqlow-ModpackFixes-0.1.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2304 icon
BepInEx-BepInExPack

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

Preferred version: 5.4.2304

README

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.1.0)

1. 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.

2. 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, and loaforc-FacilityMeltdown.
  • AI Disclosure: Code, automated tests, and procedural package icon authored with GitHub Copilot (Gemini 4 Carbon).
  • License: MIT.