Created
January 1, 2024 16:19
-
-
Save nomnomab/488d7c0a00f9a45d42bc027f8cd1423b to your computer and use it in GitHub Desktop.
Adding a custom enemy to the dev dropdown for Lethal Company
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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