Skip to content

Instantly share code, notes, and snippets.

@nomnomab
Created January 1, 2024 16:19
Show Gist options
  • Save nomnomab/488d7c0a00f9a45d42bc027f8cd1423b to your computer and use it in GitHub Desktop.
Save nomnomab/488d7c0a00f9a45d42bc027f8cd1423b to your computer and use it in GitHub Desktop.
Adding a custom enemy to the dev dropdown for Lethal Company
[HarmonyPatch(typeof(QuickMenuManager), "Debug_SetEnemyDropdownOptions")]
[HarmonyPrefix]
private static void AddGiantToDebugList(QuickMenuManager __instance) {
// ? isn't in the main level list so have to add here
// ? adding in Start didn't seem to work
var testLevel = __instance.testAllEnemiesLevel;
var firstEnemy = testLevel.Enemies.FirstOrDefault();
if (firstEnemy == null) {
Plugin.Log.LogError("Failed to get first enemy for debug list!");
return;
}
var enemies = testLevel.Enemies;
var outsideEnemies = testLevel.OutsideEnemies;
var daytimeEnemies = testLevel.DaytimeEnemies;
if (enemies.All(x => x.enemyType != Plugin.EnemyType)) {
enemies.Add(new SpawnableEnemyWithRarity {
enemyType = Plugin.EnemyType,
rarity = firstEnemy.rarity
});
Plugin.Log.LogMessage($"Added {Plugin.EnemyType.enemyName} to debug list");
}
if (outsideEnemies.All(x => x.enemyType != Plugin.EnemyType)) {
outsideEnemies.Add(new SpawnableEnemyWithRarity {
enemyType = Plugin.EnemyType,
rarity = firstEnemy.rarity
});
Plugin.Log.LogMessage($"Added {Plugin.EnemyType.enemyName} to debug list");
}
if (daytimeEnemies.All(x => x.enemyType != Plugin.EnemyType)) {
daytimeEnemies.Add(new SpawnableEnemyWithRarity {
enemyType = Plugin.EnemyType,
rarity = firstEnemy.rarity
});
Plugin.Log.LogMessage($"Added {Plugin.EnemyType.enemyName} to debug list");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment