
LethalLibPrefabGuard
Prevents landing soft-locks by cleaning null prefabs/items from LethalLib registrations before StartOfRound.Start, and names the broken mod in the log.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.