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 Mic Mod v1.0.0
Mon Mod3.dll
Decompiled 2 days agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; 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("Mon Mod3")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Mon Mod3")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e28cb677-84db-4c6a-9873-68eb96b2ae56")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] public class ItemNoiseMaker : Trap { [Header("References")] public ItemToggle itemToggle; private ItemBattery itemBattery; private ItemAttributes itemAttributes; [Header("Battery")] public bool hasBattery = true; [Header("Battery Drain")] public float batteryDrainRate = 5f; [Header("Sounds")] public Sound soundStart; public Sound soundStop; [Header("Music Sounds")] public Sound loopSound1; public Sound loopSound2; public Sound loopSound3; public Sound loopSound4; public Sound loopSound5; public Sound loopSound6; public Sound loopSound7; public Sound loopSound8; [Header("Music Chances")] [Range(0f, 100f)] public float chance1 = 40f; [Range(0f, 100f)] public float chance2 = 20f; [Range(0f, 100f)] public float chance3 = 10f; [Range(0f, 100f)] public float chance4 = 10f; [Range(0f, 100f)] public float chance5 = 7f; [Range(0f, 100f)] public float chance6 = 5f; [Range(0f, 100f)] public float chance7 = 5f; [Range(0f, 100f)] public float chance8 = 3f; [Header("Audio")] public float musicVolume = 12f; public float musicPitch = 1f; [Header("Modes")] public float mode1 = 10f; public float mode2 = 30f; public float mode3 = 60f; public bool infiniteMode = true; [Header("Input")] public KeyCode cycleKey = (KeyCode)118; private Sound currentLoopSound; private bool itemActive; private float timer; private float maxDuration; private int modeIndex = 0; private float[] durations; protected override void Start() { if (!Object.op_Implicit((Object)(object)itemToggle)) { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } itemBattery = ((Component)this).GetComponent<ItemBattery>(); if (!Object.op_Implicit((Object)(object)itemBattery)) { hasBattery = false; } itemAttributes = ((Component)this).GetComponent<ItemAttributes>(); ((Trap)this).Start(); UpdateDurations(); UpdateItemName(); if (hasBattery) { itemBattery.autoDrain = true; itemBattery.batteryDrainRate = batteryDrainRate; } Debug.Log((object)"ItemNoiseMaker loaded"); } protected override void Update() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) ((Trap)this).Update(); if (Input.GetKeyDown(cycleKey)) { CycleMode(); } if ((Object)(object)itemToggle != (Object)null) { bool flag = itemActive; itemActive = itemToggle.toggleState; if (flag != itemActive) { if (itemActive) { StartItem(); } else { StopItem(); } } } if (!itemActive) { return; } if (hasBattery && itemBattery.batteryLife <= 0f) { itemToggle.ToggleItem(false, -1); return; } if (currentLoopSound != null) { currentLoopSound.PlayLoop(true, musicVolume, musicPitch, 1f, 1f); } base.enemyInvestigate = true; if (maxDuration > 0f) { timer -= Time.deltaTime; if (timer <= 0f && (Object)(object)itemToggle != (Object)null) { itemToggle.ToggleItem(false, -1); } } } private void StartItem() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"ITEM ACTIVE"); base.trapStart = true; base.enemyInvestigate = true; if (hasBattery) { itemBattery.batteryDrainRate = batteryDrainRate; itemBattery.BatteryToggle(true); } if (soundStart != null) { soundStart.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); } currentLoopSound = GetRandomLoopSound(); if (currentLoopSound != null && (Object)(object)currentLoopSound.Source != (Object)null) { currentLoopSound.Source.Stop(); currentLoopSound.Source.time = 0f; } UpdateDurations(); maxDuration = durations[modeIndex]; if (maxDuration > 0f) { timer = maxDuration; } else { timer = 0f; } } private void StopItem() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"ITEM STOP"); base.trapTriggered = false; base.enemyInvestigate = false; if (hasBattery) { itemBattery.BatteryToggle(false); } if (currentLoopSound != null) { currentLoopSound.PlayLoop(false, musicVolume, musicPitch, 1f, 1f); if ((Object)(object)currentLoopSound.Source != (Object)null) { currentLoopSound.Source.Stop(); currentLoopSound.Source.time = 0f; } } if (soundStop != null) { soundStop.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); } } private void UpdateDurations() { if (infiniteMode) { durations = new float[4] { mode1, mode2, mode3, -1f }; } else { durations = new float[3] { mode1, mode2, mode3 }; } if (modeIndex >= durations.Length) { modeIndex = 0; } } private void CycleMode() { modeIndex++; if (modeIndex >= durations.Length) { modeIndex = 0; } UpdateItemName(); if (durations[modeIndex] < 0f) { Debug.Log((object)"Mode: BATTERY"); } else { Debug.Log((object)("Mode: " + durations[modeIndex] + "s")); } } private void UpdateItemName() { if (Object.op_Implicit((Object)(object)itemAttributes)) { string text = ((!(durations[modeIndex] < 0f)) ? (durations[modeIndex].ToString("0") + "s") : "Battery"); itemAttributes.item.itemName = "Mic [" + text + "]"; } } private Sound GetRandomLoopSound() { float num = chance1 + chance2 + chance3 + chance4 + chance5 + chance6 + chance7 + chance8; float num2 = Random.Range(0f, num); if (num2 <= chance1) { return loopSound1; } num2 -= chance1; if (num2 <= chance2) { return loopSound2; } num2 -= chance2; if (num2 <= chance3) { return loopSound3; } num2 -= chance3; if (num2 <= chance4) { return loopSound4; } num2 -= chance4; if (num2 <= chance5) { return loopSound5; } num2 -= chance5; if (num2 <= chance6) { return loopSound6; } num2 -= chance6; if (num2 <= chance7) { return loopSound7; } return loopSound8; } } [BepInPlugin("com.neil.itemnoisemaker", "ItemNoiseMaker", "1.0.0")] public class ItemNoiseMakerPlugin : BaseUnityPlugin { private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"ItemNoiseMaker loaded!"); } }