Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
LethalLibPrefabGuard
Prevents landing soft-locks by cleaning null prefabs/items from LethalLib registrations before StartOfRound.Start, and names the broken mod in the log.
| Last updated | an hour ago |
| Total downloads | 3 |
| Total rating | 0 |
| Categories | Modpacks Bug Fixes AI Generated |
| Dependency string | Harvy-LethalLibPrefabGuard-1.1.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2100README
LethalLib Prefab Guard
Prevents the "ship stuck in the landing state" soft-lock caused by mods registering broken (null) items or enemies through LethalLib.
The problem
LethalLib's StartOfRound.Start hook iterates its registered-prefab list before
running the game's own round-start logic. If any mod registered a null prefab
(common after game updates break old asset bundles), that loop throws and the
vanilla StartOfRound.Start never runs. Symptoms:
- Ship stuck in the "landing" state forever — HUD works, nothing else does
- Dark screen / unresponsive controls when loading in
- Ship interior mods (e.g. wider/two-story ships) present but not applying, with flickering or white-streak textures
What this does
Right before StartOfRound.Start, this guard:
- Removes null entries from LethalLib's
prefabsToFixlist - Removes null entries from
StartOfRound.allItemsList - Logs a
CULPRIT:warning naming the mod that registered each broken item/enemy (using LethalLib's own registration metadata), so you know what to update or remove
If nothing is broken, it does nothing. Works with or without LethalLib installed.
Technical note
A Harmony prefix cannot guard against this: HarmonyX patches the original method
(innermost layer) while MonoMod On. hooks wrap outside it, so LethalLib's hook
throws before any prefix runs. This guard installs its own MonoMod hook after
LethalLib's, making it the outer layer.