Lethal Company
Install with App

Details

Latest version
1.0.0
Last Updated
First Uploaded
Downloads
126
Likes
0
Size
145KB
Dependants

Orbit Enemy Purge

A lightweight, automated Lethal Company mod that clears, despawns, and purges all enemies when the ship enters or stays in orbit, eliminating the bug where enemies on the ship are transferred to other moons when landing.


The Problem

In vanilla Lethal Company and modded lobbies, enemies (e.g. Masked, Spiders, Baboon Hawks, Hoarding Bugs, or modded creatures) that enter the ship elevator bounds or get parented to the ship often survive scene unloading when the ship departs. Because the ship is persistent across scenes (DontDestroyOnLoad), these enemies remain on the ship in orbit and are transported to whichever moon you land on next.


How This Mod Solves It

Orbit Enemy Purge hooks into the ship's orbit lifecycle:

  1. Round-End Scoreboard Display & Orbit Transition:

    • Triggers at the exact moment the performance report / scoreboard is shown in orbit (SwitchMapMonitorPurpose during EndOfGame), and when orbit is fully initialized (SetShipReadyToLand). Enemies remain visible during departure and are purged at the round conclusion before players revive.
    • Sweeps the entire scene and ship hierarchy for all EnemyAI entities, enemy colliders, and nest objects.
    • Authoritatively despawns networked enemy objects (NetworkObject.Despawn(true)) on host/server and destroys residual local instances on clients.
    • Clears RoundManager.Instance.SpawnedEnemies and resets active enemy power counters.
  2. Pre-Landing Sweep (StartGame):

    • Immediately before ship descent begins when the lever is pulled for a new moon, a final purge executes to guarantee a clean ship arrival.

Configuration

Settings are saved to BepInEx/config/com.v0id.orbitenemypurge.cfg:

  • EnablePurgeOnShipLeave (Default: true): Purge all enemies when the round-end scoreboard is displayed in orbit.
  • EnablePreLandingSweep (Default: true): Purge immediately before descending onto a new moon.
  • LogPurgedEnemies (Default: true): Log sweep executions and purged enemy information in the console (both in orbit and when not in orbit).

Compatibility

  • Fully compatible with vanilla and modded enemies (all enemies derived from EnemyAI).
  • Preserves player corpses (DeadBodyInfo) for recovery, revival, and quota value.
  • Host and client friendly (host performs authoritative network despawn; client ensures local visual/collider destruction).
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.