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.
Decompiled source of Leathal Company Sound Mod v1.45.321
LethalCompanySoundMod/LeathalCompanyTestMod.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using LeathalCompanySoundMod.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LeathalCompanyTestMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LeathalCompanyTestMod")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("130515a2-18bf-431d-8a96-3adf58c803b5")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace LeathalCompanySoundMod { [BepInPlugin("Goggy.LeathalCompanySoundMod", "Leathal Company Sound Mod", "1.0.0.1")] public class Lethalcompanymodbase : BaseUnityPlugin { private const string modGUID = "Goggy.LeathalCompanySoundMod"; private const string modName = "Leathal Company Sound Mod"; private const string modVersion = "1.0.0.1"; private readonly Harmony harmony = new Harmony("Goggy.LeathalCompanySoundMod"); private static Lethalcompanymodbase Instance; internal static ManualLogSource mls; internal static List<AudioClip> SoundFX; internal static AssetBundle bundle; internal static AudioSource audiosource; internal static AudioSource audiosource1; internal static AudioClip[] SoundArray; internal static AudioClip[] SoundArray1; internal static AudioClip[] SoundArray2; internal static AudioClip[] SoundArray3; internal static AudioClip[] SoundArray4; internal static AudioClip[] SoundArray5; internal static AudioClip[] SoundArray6; internal static AudioClip[] SoundArray7; private void Awake() { //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Goggy.LeathalCompanySoundMod"); mls.LogInfo((object)"The mod has awakened"); harmony.PatchAll(typeof(DropShipPatch)); harmony.PatchAll(typeof(JesterAIPatch)); harmony.PatchAll(typeof(LandminePatch)); harmony.PatchAll(typeof(FlowermanAIPatch)); harmony.PatchAll(typeof(Lethalcompanymodbase)); harmony.PatchAll(typeof(TurretDeathPatch)); harmony.PatchAll(typeof(TurretFarShootingPatch)); harmony.PatchAll(typeof(LittleGirlAIPatch)); harmony.PatchAll(typeof(DogAIPatch)); harmony.PatchAll(typeof(MadHoarderBugAIPatch)); harmony.PatchAll(typeof(HoarderBugAIChitterPatch)); harmony.PatchAll(typeof(AirHornNoiseClosePatch)); harmony.PatchAll(typeof(AirHornNoiseFarPatch)); harmony.PatchAll(typeof(ShovelHitPatch)); harmony.PatchAll(typeof(SnareFleaClosePatch)); mls = ((BaseUnityPlugin)this).Logger; SoundFX = new List<AudioClip>(0); string location = ((BaseUnityPlugin)Instance).Info.Location; location = location.TrimEnd("LeathalCompanyTestMod.dll".ToCharArray()); LoadAssetBundle(location + "coilheadclose"); LoadAssetBundle(location + "jackboxclose"); LoadAssetBundle(location + "brakendeath"); LoadAssetBundle(location + "stepedonmine"); LoadAssetBundle(location + "wormdeath"); LoadAssetBundle(location + "turretdeath"); LoadAssetBundle(location + "turretfarshooting"); LoadAssetBundle(location + "littlegirlclose"); LoadAssetBundle(location + "dogclose"); LoadAssetBundle(location + "lootbugmad"); LoadAssetBundle(location + "snarefleaclose"); LoadAssetBundle(location + "nutcrackerkick"); LoadAssetBundle(location + "nutcrackerdance"); audiosource = new AudioSource(); audiosource = ((Component)this).gameObject.AddComponent<AudioSource>(); string location2 = ((BaseUnityPlugin)Instance).Info.Location; location2 = location2.TrimEnd("LeathalCompanyTestMod.dll".ToCharArray()); LoadAssetBundleSource(location2 + "dropshipnear"); SoundArray = (AudioClip[])(object)new AudioClip[0]; string location3 = ((BaseUnityPlugin)Instance).Info.Location; location3 = location3.TrimEnd("LeathalCompanyTestMod.dll".ToCharArray()); LoadAssetBundleArray(location3 + "lootbugclose"); SoundArray1 = (AudioClip[])(object)new AudioClip[1]; location3 = location3.TrimEnd("LeathalCompanyTestMod.dll".ToCharArray()); LoadAssetBundleArray1(location3 + "airhornclose"); SoundArray2 = (AudioClip[])(object)new AudioClip[2]; location3 = location3.TrimEnd("LeathalCompanyTestMod.dll".ToCharArray()); LoadAssetBundleArray2(location3 + "airhornfar"); SoundArray3 = (AudioClip[])(object)new AudioClip[3]; location3 = location3.TrimEnd("LeathalCompanyTestMod.dll".ToCharArray()); LoadAssetBundleArray3(location3 + "shovlehit"); SoundArray4 = (AudioClip[])(object)new AudioClip[4]; location3 = location3.TrimEnd("LeathalCompanyTestMod.dll".ToCharArray()); LoadAssetBundleArray4(location3 + "thumperclose"); SoundArray5 = (AudioClip[])(object)new AudioClip[5]; location3 = location3.TrimEnd("LeathalCompanyTestMod.dll".ToCharArray()); LoadAssetBundleArray5(location3 + "dora"); LoadAssetBundleArray5(location3 + "elmo"); SoundArray6 = (AudioClip[])(object)new AudioClip[6]; location3 = location3.TrimEnd("LeathalCompanyTestMod.dll".ToCharArray()); LoadAssetBundleArray5(location3 + "night-time1"); LoadAssetBundleArray5(location3 + "night-time2"); SoundArray6 = (AudioClip[])(object)new AudioClip[7]; location3 = location3.TrimEnd("LeathalCompanyTestMod.dll".ToCharArray()); LoadAssetBundleArray5(location3 + "wormclose"); } private void LoadAssetBundle(string path) { AssetBundle val = AssetBundle.LoadFromFile(path); if ((Object)(object)val != (Object)null) { mls.LogInfo((object)("Asset bundle '" + path + "' loaded successfully")); SoundFX.AddRange(val.LoadAllAssets<AudioClip>()); } else { mls.LogError((object)("Failed to load asset bundle '" + path + "'")); } } private void LoadAssetBundleArray(string path) { AssetBundle val = AssetBundle.LoadFromFile(path); if ((Object)(object)val != (Object)null) { mls.LogInfo((object)("Asset bundle '" + path + "' loaded successfully")); SoundArray = val.LoadAllAssets<AudioClip>().ToArray(); } else { mls.LogError((object)("Failed to load asset bundle '" + path + "'")); } } private void LoadAssetBundleArray1(string path) { AssetBundle val = AssetBundle.LoadFromFile(path); if ((Object)(object)val != (Object)null) { mls.LogInfo((object)("Asset bundle '" + path + "' loaded successfully")); SoundArray1 = val.LoadAllAssets<AudioClip>().ToArray(); } else { mls.LogError((object)("Failed to load asset bundle '" + path + "'")); } } private void LoadAssetBundleArray2(string path) { AssetBundle val = AssetBundle.LoadFromFile(path); if ((Object)(object)val != (Object)null) { mls.LogInfo((object)("Asset bundle '" + path + "' loaded successfully")); SoundArray2 = val.LoadAllAssets<AudioClip>().ToArray(); } else { mls.LogError((object)("Failed to load asset bundle '" + path + "'")); } } private void LoadAssetBundleArray3(string path) { AssetBundle val = AssetBundle.LoadFromFile(path); if ((Object)(object)val != (Object)null) { mls.LogInfo((object)("Asset bundle '" + path + "' loaded successfully")); SoundArray3 = val.LoadAllAssets<AudioClip>().ToArray(); } else { mls.LogError((object)("Failed to load asset bundle '" + path + "'")); } } private void LoadAssetBundleArray4(string path) { AssetBundle val = AssetBundle.LoadFromFile(path); if ((Object)(object)val != (Object)null) { mls.LogInfo((object)("Asset bundle '" + path + "' loaded successfully")); SoundArray4 = val.LoadAllAssets<AudioClip>().ToArray(); } else { mls.LogError((object)("Failed to load asset bundle '" + path + "'")); } } private void LoadAssetBundleArray5(string path) { AssetBundle val = AssetBundle.LoadFromFile(path); if ((Object)(object)val != (Object)null) { mls.LogInfo((object)("Asset bundle '" + path + "' loaded successfully")); SoundArray5 = val.LoadAllAssets<AudioClip>().ToArray(); } else { mls.LogError((object)("Failed to load asset bundle '" + path + "'")); } } private void LoadAssetBundleArray6(string path) { AssetBundle val = AssetBundle.LoadFromFile(path); if ((Object)(object)val != (Object)null) { mls.LogInfo((object)("Asset bundle '" + path + "' loaded successfully")); SoundArray6 = val.LoadAllAssets<AudioClip>().ToArray(); } else { mls.LogError((object)("Failed to load asset bundle '" + path + "'")); } } private void LoadAssetBundleArray7(string path) { AssetBundle val = AssetBundle.LoadFromFile(path); if ((Object)(object)val != (Object)null) { mls.LogInfo((object)("Asset bundle '" + path + "' loaded successfully")); SoundArray7 = val.LoadAllAssets<AudioClip>().ToArray(); } else { mls.LogError((object)("Failed to load asset bundle '" + path + "'")); } } public void LoadAssetBundleSource(string path) { AssetBundle val = AssetBundle.LoadFromFile(path); if ((Object)(object)val != (Object)null) { mls.LogInfo((object)("Asset bundle '" + path + "' loaded successfully")); AudioClip[] array = val.LoadAllAssets<AudioClip>(); if (array.Length != 0) { audiosource.clip = array[0]; audiosource.Play(); } else { mls.LogError((object)("No audio clips found in asset bundle '" + path + "'")); } val.Unload(false); } else { mls.LogError((object)("Failed to load asset bundle '" + path + "'")); } } } } namespace LeathalCompanySoundMod.Patches { [HarmonyPatch(typeof(ElevatorAnimationEvents))] internal class DropShipPatch { [HarmonyPostfix] [HarmonyPatch("PlayAudio")] private static void OverrideAudio(ElevatorAnimationEvents __instance) { __instance.audioToPlay = Lethalcompanymodbase.audiosource; } } [HarmonyPatch(typeof(NutcrackerEnemyAI))] internal class NutCrackerKickPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(NutcrackerEnemyAI __instance) { List<AudioClip> soundFX = Lethalcompanymodbase.SoundFX; if (soundFX != null) { Debug.Log((object)$"SoundFX list count: {soundFX.Count}"); for (int i = 0; i < soundFX.Count; i++) { Debug.Log((object)$"Index {i}: {((Object)soundFX[i]).name}"); } int num = 12; if (num >= 12 && num < soundFX.Count) { __instance.kickSFX = soundFX[num]; } else { Debug.LogError((object)$"Index {num} is out of range."); } } else { Debug.LogError((object)"SoundFX list is null."); } } } [HarmonyPatch(typeof(DressGirlAI))] internal class LittleGirlStarringPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void LittleGirlPatch(DressGirlAI __instance) { try { if ((Object)(object)__instance != (Object)null) { Debug.Log((object)"LittleGirlStarringPatch - Start method patched successfully."); if (Lethalcompanymodbase.SoundArray5 != null && Lethalcompanymodbase.SoundArray5.Length != 0) { Debug.Log((object)$"Assigning SoundArray5 to __appearStaringSFX. SoundArray5 length: {Lethalcompanymodbase.SoundArray5.Length}"); __instance.appearStaringSFX = Lethalcompanymodbase.SoundArray5; } else { Debug.LogWarning((object)"SoundArray5 is null or empty. Check if the asset bundle was loaded successfully."); } } else { Debug.LogError((object)"DressGirlAI instance is null."); } } catch (Exception arg) { Debug.LogError((object)$"Error in DressGirlAIPatch: {arg}"); } } } [HarmonyPatch(typeof(CrawlerAI))] internal class ThumperMadPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void CrawlerAudioPatch(CrawlerAI __instance) { try { if ((Object)(object)__instance != (Object)null) { Debug.Log((object)"ThumperMadPatch - Start method patched successfully."); if (Lethalcompanymodbase.SoundArray4 != null && Lethalcompanymodbase.SoundArray4.Length != 0) { Debug.Log((object)$"Assigning SoundArray4 to __longRoarSFX. SoundArray4 length: {Lethalcompanymodbase.SoundArray4.Length}"); __instance.longRoarSFX = Lethalcompanymodbase.SoundArray4; } else { Debug.LogWarning((object)"SoundArray4 is null or empty. Check if the asset bundle was loaded successfully."); } } else { Debug.LogError((object)"CrawlerAI instance is null."); } } catch (Exception arg) { Debug.LogError((object)$"Error in ThumperMadPatch: {arg}"); } } } [HarmonyPatch(typeof(CentipedeAI))] internal class SnareFleaClosePatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(CentipedeAI __instance) { List<AudioClip> soundFX = Lethalcompanymodbase.SoundFX; if (soundFX != null) { Debug.Log((object)$"SoundFX list count: {soundFX.Count}"); for (int i = 0; i < soundFX.Count; i++) { Debug.Log((object)$"Index {i}: {((Object)soundFX[i]).name}"); } int num = 10; if (num >= 10 && num < soundFX.Count) { __instance.fallShriek = soundFX[num]; } else { Debug.LogError((object)$"Index {num} is out of range."); } } else { Debug.LogError((object)"SoundFX list is null."); } } } [HarmonyPatch(typeof(Shovel))] internal class ShovelHitPatch { [HarmonyPatch("HitShovel")] [HarmonyPostfix] public static void ShovelhitPatch(Shovel __instance) { try { if ((Object)(object)__instance != (Object)null) { Debug.Log((object)"ShovelHitPatch - Start method patched successfully."); if (Lethalcompanymodbase.SoundArray3 != null && Lethalcompanymodbase.SoundArray3.Length != 0) { Debug.Log((object)$"Assigning SoundArray3 to __hitSFX. SoundArray3 length: {Lethalcompanymodbase.SoundArray3.Length}"); __instance.hitSFX = Lethalcompanymodbase.SoundArray3; } else { Debug.LogWarning((object)"SoundArray3 is null or empty. Check if the asset bundle was loaded successfully."); } } else { Debug.LogError((object)"Shovel instance is null."); } } catch (Exception arg) { Debug.LogError((object)$"Error in ShovelHitPatch: {arg}"); } } } [HarmonyPatch(typeof(NoisemakerProp))] internal class AirHornNoiseFarPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void AirHornNoisePatch(NoisemakerProp __instance) { try { if ((Object)(object)__instance != (Object)null) { Debug.Log((object)"AirHornNoiseFarPatch - Start method patched successfully."); if (Lethalcompanymodbase.SoundArray2 != null && Lethalcompanymodbase.SoundArray2.Length != 0) { Debug.Log((object)$"Assigning SoundArray2 to __noiseSFXFar. SoundArray2 length: {Lethalcompanymodbase.SoundArray2.Length}"); __instance.noiseSFXFar = Lethalcompanymodbase.SoundArray2; } else { Debug.LogWarning((object)"SoundArray2 is null or empty. Check if the asset bundle was loaded successfully."); } } else { Debug.LogError((object)"NoisemakerProp instance is null."); } } catch (Exception arg) { Debug.LogError((object)$"Error in AirHornNoiseFarPatch: {arg}"); } } } [HarmonyPatch(typeof(NoisemakerProp))] internal class AirHornNoiseClosePatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void AirHornNoisePatch(NoisemakerProp __instance) { try { if ((Object)(object)__instance != (Object)null) { Debug.Log((object)"AirHornNoiseClosePatch - Start method patched successfully."); if (Lethalcompanymodbase.SoundArray1 != null && Lethalcompanymodbase.SoundArray1.Length != 0) { Debug.Log((object)$"Assigning SoundArray1 to __noiseSFX. SoundArray1 length: {Lethalcompanymodbase.SoundArray1.Length}"); __instance.noiseSFX = Lethalcompanymodbase.SoundArray1; } else { Debug.LogWarning((object)"SoundArray1 is null or empty. Check if the asset bundle was loaded successfully."); } } else { Debug.LogError((object)"NoisemakerProp instance is null."); } } catch (Exception arg) { Debug.LogError((object)$"Error in AirHornNoiseClosePatch: {arg}"); } } } [HarmonyPatch(typeof(HoarderBugAI))] internal class HoarderBugAIChitterPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void HoarderBugAudioPatch(HoarderBugAI __instance) { try { if ((Object)(object)__instance != (Object)null) { Debug.Log((object)"HoarderBugAIChitterPatch - Start method patched successfully."); if (Lethalcompanymodbase.SoundArray != null && Lethalcompanymodbase.SoundArray.Length != 0) { Debug.Log((object)$"Assigning SoundArray to __chitterSFX. SoundArray length: {Lethalcompanymodbase.SoundArray.Length}"); __instance.chitterSFX = Lethalcompanymodbase.SoundArray; } else { Debug.LogWarning((object)"SoundArray is null or empty. Check if the asset bundle was loaded successfully."); } } else { Debug.LogError((object)"HoarderBugAI instance is null."); } } catch (Exception arg) { Debug.LogError((object)$"Error in HoarderBugAIChitterPatch: {arg}"); } } } [HarmonyPatch(typeof(HoarderBugAI))] internal class MadHoarderBugAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(HoarderBugAI __instance) { List<AudioClip> soundFX = Lethalcompanymodbase.SoundFX; if (soundFX != null) { Debug.Log((object)$"SoundFX list count: {soundFX.Count}"); for (int i = 0; i < soundFX.Count; i++) { Debug.Log((object)$"Index {i}: {((Object)soundFX[i]).name}"); } int num = 9; if (num >= 9 && num < soundFX.Count) { __instance.angryVoiceSFX = soundFX[num]; } else { Debug.LogError((object)$"Index {num} is out of range."); } } else { Debug.LogError((object)"SoundFX list is null."); } } } [HarmonyPatch(typeof(JesterAI))] internal class JesterAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(JesterAI __instance) { List<AudioClip> soundFX = Lethalcompanymodbase.SoundFX; if (soundFX != null) { Debug.Log((object)$"SoundFX list count: {soundFX.Count}"); for (int i = 0; i < soundFX.Count; i++) { Debug.Log((object)$"Index {i}: {((Object)soundFX[i]).name}"); } int num = 1; if (num >= 1 && num < soundFX.Count) { __instance.popGoesTheWeaselTheme = soundFX[num]; } else { Debug.LogError((object)$"Index {num} is out of range."); } } else { Debug.LogError((object)"SoundFX list is null."); } } } [HarmonyPatch(typeof(DressGirlAI))] internal class LittleGirlAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(DressGirlAI __instance) { List<AudioClip> soundFX = Lethalcompanymodbase.SoundFX; if (soundFX != null) { Debug.Log((object)$"SoundFX list count: {soundFX.Count}"); for (int i = 0; i < soundFX.Count; i++) { Debug.Log((object)$"Index {i}: {((Object)soundFX[i]).name}"); } int num = 7; if (num >= 7 && num < soundFX.Count) { __instance.breathingSFX = soundFX[num]; } else { Debug.LogError((object)$"Index {num} is out of range."); } } else { Debug.LogError((object)"SoundFX list is null."); } } } [HarmonyPatch(typeof(Turret))] internal class TurretDeathPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(Turret __instance) { List<AudioClip> soundFX = Lethalcompanymodbase.SoundFX; if (soundFX != null) { Debug.Log((object)$"SoundFX list count: {soundFX.Count}"); for (int i = 0; i < soundFX.Count; i++) { Debug.Log((object)$"Index {i}: {((Object)soundFX[i]).name}"); } int num = 5; if (num >= 5 && num < soundFX.Count) { __instance.firingFarSFX = soundFX[num]; } else { Debug.LogError((object)$"Index {num} is out of range."); } } else { Debug.LogError((object)"SoundFX list is null."); } } } [HarmonyPatch(typeof(MouthDogAI))] internal class DogAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(MouthDogAI __instance) { List<AudioClip> soundFX = Lethalcompanymodbase.SoundFX; if (soundFX != null) { Debug.Log((object)$"SoundFX list count: {soundFX.Count}"); for (int i = 0; i < soundFX.Count; i++) { Debug.Log((object)$"Index {i}: {((Object)soundFX[i]).name}"); } int num = 8; if (num >= 8 && num < soundFX.Count) { __instance.screamSFX = soundFX[num]; } else { Debug.LogError((object)$"Index {num} is out of range."); } } else { Debug.LogError((object)"SoundFX list is null."); } } } [HarmonyPatch(typeof(Turret))] internal class TurretFarShootingPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(Turret __instance) { List<AudioClip> soundFX = Lethalcompanymodbase.SoundFX; if (soundFX != null) { Debug.Log((object)$"SoundFX list count: {soundFX.Count}"); for (int i = 0; i < soundFX.Count; i++) { Debug.Log((object)$"Index {i}: {((Object)soundFX[i]).name}"); } int num = 6; if (num >= 6 && num < soundFX.Count) { __instance.firingSFX = soundFX[num]; } else { Debug.LogError((object)$"Index {num} is out of range."); } } else { Debug.LogError((object)"SoundFX list is null."); } } } [HarmonyPatch(typeof(Landmine))] internal class LandminePatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(Landmine __instance) { List<AudioClip> soundFX = Lethalcompanymodbase.SoundFX; if (soundFX != null) { Debug.Log((object)$"SoundFX list count: {soundFX.Count}"); for (int i = 0; i < soundFX.Count; i++) { Debug.Log((object)$"Index {i}: {((Object)soundFX[i]).name}"); } int num = 3; if (num >= 3 && num < soundFX.Count) { __instance.minePress = soundFX[num]; } else { Debug.LogError((object)$"Index {num} is out of range."); } } else { Debug.LogError((object)"SoundFX list is null."); } } } [HarmonyPatch(typeof(FlowermanAI))] internal class FlowermanAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(FlowermanAI __instance) { List<AudioClip> soundFX = Lethalcompanymodbase.SoundFX; if (soundFX != null) { Debug.Log((object)$"SoundFX list count: {soundFX.Count}"); for (int i = 0; i < soundFX.Count; i++) { Debug.Log((object)$"Index {i}: {((Object)soundFX[i]).name}"); } int num = 2; if (num >= 2 && num < soundFX.Count) { __instance.crackNeckSFX = soundFX[num]; } else { Debug.LogError((object)$"Index {num} is out of range."); } } else { Debug.LogError((object)"SoundFX list is null."); } } } }