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 JesterGlobalMusic v1.0.1
LCGlobalJester.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using LCGlobalJester.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("LCGlobalJester")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LCGlobalJester")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("5b421547-9d4f-45f3-bb90-7cde38ebf0c0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace LCGlobalJester { [BepInPlugin("Aellysse.LCGlobalJester", "JesterGlobalMusic", "1.0.1")] public class GlobalJesterModBase : BaseUnityPlugin { private const string modGUID = "Aellysse.LCGlobalJester"; private const string modName = "JesterGlobalMusic"; private const string modVersion = "1.0.1"; private readonly Harmony harmony = new Harmony("Aellysse.LCGlobalJester"); public static GlobalJesterModBase Instance; public ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Aellysse.LCGlobalJester"); mls.LogInfo((object)"LC Global Jester Sound awoken"); harmony.PatchAll(typeof(GlobalJesterModBase)); harmony.PatchAll(typeof(JesterAIPatch)); } } } namespace LCGlobalJester.Patches { [HarmonyPatch(typeof(JesterAI))] internal class JesterAIPatch { private static float savedMinDistance; private static float savedMaxDistance; private static float savedVolume; [HarmonyPatch("Start")] [HarmonyPostfix] private static void globalAudioPatch(ref AudioSource ___farAudio) { savedMinDistance = ___farAudio.minDistance; savedMaxDistance = ___farAudio.maxDistance; savedVolume = ___farAudio.volume; } [HarmonyPatch("Update")] [HarmonyPrefix] private static void globalAudioPatch(ref AudioSource ___farAudio, ref int ___currentBehaviourStateIndex) { if (___currentBehaviourStateIndex == 1) { ___farAudio.minDistance = 3f; ___farAudio.maxDistance = 300f; ___farAudio.volume = 0.7f; } } [HarmonyPatch("Update")] [HarmonyPostfix] private static void restoreOldValues(ref AudioSource ___farAudio, ref Animator ___creatureAnimator) { if (___creatureAnimator.GetBool("poppedOut")) { ___farAudio.minDistance = savedMinDistance; ___farAudio.maxDistance = savedMaxDistance; ___farAudio.volume = savedVolume; } } } }