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 ReverbTriggerFix v0.4.0
BepInEx/plugins/ReverbTriggerFix.dll
Decompiled a week agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using ReverbTriggerFix.Components; using ReverbTriggerFix.Core; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("ReverbTriggerFix")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ReverbTriggerFix")] [assembly: AssemblyTitle("ReverbTriggerFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ReverbTriggerFix { [BepInPlugin("JacobG5.ReverbTriggerFix", "ReverbTriggerFix", "0.4.0")] public class ReverbTriggerFixes : BaseUnityPlugin { private const string modGUID = "JacobG5.ReverbTriggerFix"; private const string modName = "ReverbTriggerFix"; private const string modVersion = "0.4.0"; public static ReverbTriggerFixes Instance; internal readonly Harmony harmony = new Harmony("JacobG5.ReverbTriggerFix"); internal ManualLogSource mls; public static ConfigEntry<bool> disableMod; public static ConfigEntry<bool> extendedLogging; internal void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("JacobG5.ReverbTriggerFix"); disableMod = ((BaseUnityPlugin)this).Config.Bind<bool>("Core", "disableMod", false, "Disables patches forcing reverb triggers to only run checks on trigger enter. Keeps patches for caching reverb presets reguardless."); extendedLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "extendedLogging", false, "Logs more info to the console when enabled.\n\n*THIS WILL SPAM YOUR CONSOLE DEPENDING ON YOUR OTHER SETTINGS*"); harmony.PatchAll(typeof(AudioReverbFixCore)); if (!disableMod.Value) { harmony.PatchAll(typeof(AudioReverbTriggerEnterModule)); } } } } namespace ReverbTriggerFix.Core { internal static class AudioReverbFixCore { [CompilerGenerated] private sealed class <FindObjectTranspiler>d__3 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> enumerableInstructions; public IEnumerable<CodeInstruction> <>3__enumerableInstructions; private MethodBase original; public MethodBase <>3__original; private MethodInfo <FindObjectCall>5__1; private MethodInfo <ReplacementMethod>5__2; private int <found>5__3; private CodeInstruction[] <instructions>5__4; private List<CodeInstruction> <newInstructions>5__5; private CodeInstruction[] <>s__6; private int <>s__7; private CodeInstruction <instruction>5__8; private CodeInstruction <newInst>5__9; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FindObjectTranspiler>d__3(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <FindObjectCall>5__1 = null; <ReplacementMethod>5__2 = null; <instructions>5__4 = null; <newInstructions>5__5 = null; <>s__6 = null; <instruction>5__8 = null; <newInst>5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <FindObjectCall>5__1 = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => Object.FindObjectOfType<AudioReverbPresets>())); <ReplacementMethod>5__2 = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => GetAudioReverbPresets())); <found>5__3 = 0; <instructions>5__4 = enumerableInstructions.ToArray(); <newInstructions>5__5 = new List<CodeInstruction>(); <>s__6 = <instructions>5__4; <>s__7 = 0; break; case 1: <>1__state = -1; <newInst>5__9 = null; goto IL_0179; case 2: { <>1__state = -1; goto IL_0179; } IL_0179: <instruction>5__8 = null; <>s__7++; break; } if (<>s__7 < <>s__6.Length) { <instruction>5__8 = <>s__6[<>s__7]; if (CodeInstructionExtensions.Calls(<instruction>5__8, <FindObjectCall>5__1)) { <found>5__3++; <newInst>5__9 = new CodeInstruction(OpCodes.Call, (object)<ReplacementMethod>5__2); <newInst>5__9.labels.AddRange(<instruction>5__8.labels); <>2__current = <newInst>5__9; <>1__state = 1; return true; } <>2__current = <instruction>5__8; <>1__state = 2; return true; } <>s__6 = null; if (<found>5__3 > 0) { ReverbTriggerFixes.Instance.mls.LogInfo((object)$"Fixed {<found>5__3} in {original.DeclaringType.FullName}"); } else { ReverbTriggerFixes.Instance.mls.LogInfo((object)("Couldn't find call to UnityEngine.Object.FindObjectOfType! " + original.DeclaringType.FullName)); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <FindObjectTranspiler>d__3 <FindObjectTranspiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <FindObjectTranspiler>d__ = this; } else { <FindObjectTranspiler>d__ = new <FindObjectTranspiler>d__3(0); } <FindObjectTranspiler>d__.enumerableInstructions = <>3__enumerableInstructions; <FindObjectTranspiler>d__.original = <>3__original; return <FindObjectTranspiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } private static AudioReverbPresets levelPresets; public static AudioReverbPresets GetAudioReverbPresets() { if (Object.op_Implicit((Object)(object)levelPresets)) { return levelPresets; } ReverbTriggerFixes.Instance.mls.LogInfo((object)"Caching reverb presets."); return levelPresets = Object.FindObjectOfType<AudioReverbPresets>(); } [HarmonyPatch(typeof(AudioReverbTrigger), "OnTriggerStay")] [HarmonyPrefix] public static bool OnTriggerStay(Collider other, AudioReverbTrigger __instance) { AudioReverbTriggerFix audioReverbTriggerFix = default(AudioReverbTriggerFix); if (((Component)__instance).TryGetComponent<AudioReverbTriggerFix>(ref audioReverbTriggerFix) && !audioReverbTriggerFix.allow) { return false; } if (ReverbTriggerFixes.extendedLogging.Value) { ReverbTriggerFixes.Instance.mls.LogInfo((object)("Checking " + ((Object)other).name)); } return true; } [IteratorStateMachine(typeof(<FindObjectTranspiler>d__3))] [HarmonyPatch(typeof(AudioReverbTrigger), "ChangeAudioReverbForPlayer")] [HarmonyPatch(typeof(EntranceTeleport), "SetAudioPreset")] [HarmonyPatch(typeof(JetpackItem), "ActivateJetpack")] [HarmonyPatch(typeof(PlayerControllerB), "SetSpectatedPlayerEffects")] [HarmonyPatch(typeof(ShipTeleporter), "TeleportPlayerOutWithInverseTeleporter")] [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> FindObjectTranspiler(IEnumerable<CodeInstruction> enumerableInstructions, MethodBase original) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FindObjectTranspiler>d__3(-2) { <>3__enumerableInstructions = enumerableInstructions, <>3__original = original }; } } internal static class AudioReverbTriggerEnterModule { [HarmonyPatch(typeof(AudioReverbTrigger), "Start")] [HarmonyPrefix] public static void AddFixComponentStart(AudioReverbTrigger __instance) { ((Component)__instance).gameObject.AddComponent<AudioReverbTriggerFix>().trigger = __instance; } } } namespace ReverbTriggerFix.Components { public class AudioReverbTriggerFix : MonoBehaviour { public AudioReverbTrigger trigger; public bool allow = false; public void Start() { if (ReverbTriggerFixes.extendedLogging.Value) { ReverbTriggerFixes.Instance.mls.LogInfo((object)("Patching: " + ((Object)trigger).name)); } } public void OnTriggerEnter(Collider other) { allow = true; trigger.OnTriggerStay(other); allow = false; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }