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 JesterStompShake v1.0.11
JesterStompShake.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using JesterStompShake.Patches; using Microsoft.CodeAnalysis; 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("RadiationIsCool")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RadiationIsCool")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8ee335db-0cbe-470c-8fbc-69263f01b35a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [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 JesterStompShake { [BepInPlugin("Piggy.JesterStompShake", "JesterStompShake", "1.0.11")] public class Plugin : BaseUnityPlugin { private const string modGUID = "Piggy.JesterStompShake"; private const string modName = "JesterStompShake"; private const string modVersion = "1.0.11"; private readonly Harmony harmony = new Harmony("Piggy.JesterStompShake"); private static Plugin Instance; public static ManualLogSource mls; public static int ShakeIntensity; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Piggy.JesterStompShake"); ShakeIntensity = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Shake Intensity", 2, "Camera shake intensity (1-3)").Value; mls.LogInfo((object)"Jester Stomp Shake is loaded"); PlayerControllerBPatch.shakeIntensity = ShakeIntensity; Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } } namespace JesterStompShake.Patches { [HarmonyPatch(typeof(EnemyAI))] internal class EnemyAIPatch { [HarmonyPostfix] [HarmonyPatch("OnDestroy")] private static void OnDestroy_Postfix(EnemyAI __instance) { if (__instance is JesterAI) { JesterAI component = ((Component)__instance).GetComponent<JesterAI>(); PlayerControllerBPatch.cachedJesters.Remove(component); } } } [HarmonyPatch(typeof(PlayAudioAnimationEvent))] internal class PlayAudioAnimationEventPatch { [HarmonyPrefix] [HarmonyPatch("PlayAudio2RandomClip")] private static void PlayAudio2RandomClip_Patch() { JesterStompCheck.jesterStomped = true; } } public static class JesterStompCheck { public static bool jesterStomped; } [HarmonyPatch(typeof(JesterAI))] internal class JesterAIPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(JesterAI __instance) { PlayerControllerBPatch.cachedJesters.Add(__instance); } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPrefix] [HarmonyPatch("UnloadSceneObjectsEarly")] private static void UnloadSceneObjectsEarly_Prefix() { PlayerControllerBPatch.cachedJesters.Clear(); } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { public static int shakeIntensity; public static List<JesterAI> cachedJesters = new List<JesterAI>(); private static float updateInterval = 0.1f; private static float lastUpdateTime; private static float distance; [HarmonyPostfix] [HarmonyPatch("Update")] private static void Update_Postfix(ref Transform ___thisPlayerBody, ref bool ___isCameraDisabled) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (___isCameraDisabled || cachedJesters.Count == 0) { return; } if (Time.time - lastUpdateTime > updateInterval) { foreach (JesterAI cachedJester in cachedJesters) { if ((Object)(object)cachedJester == (Object)null) { break; } distance = Vector3.Distance(___thisPlayerBody.position, ((Component)cachedJester).transform.position); if (((EnemyAI)cachedJester).currentBehaviourStateIndex != 2) { break; } } } else { lastUpdateTime = Time.time; } if (JesterStompCheck.jesterStomped) { HandleShake(distance); } } private static void HandleShake(float distance) { if (distance < 4f) { Shake((ScreenShakeType)0, (ScreenShakeType)1, (ScreenShakeType)3); } else if (distance < 6f) { Shake((ScreenShakeType)0, (ScreenShakeType)1, (ScreenShakeType)1); } else if (distance < 35f) { Shake((ScreenShakeType)0, (ScreenShakeType)0, (ScreenShakeType)0, ignoreSmallOne: true); } } private static void Shake(ScreenShakeType small, ScreenShakeType medium, ScreenShakeType large, bool ignoreSmallOne = false) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) switch (shakeIntensity) { case 1: if (!ignoreSmallOne) { HUDManager.Instance.ShakeCamera(small); } break; case 2: HUDManager.Instance.ShakeCamera(medium); break; case 3: HUDManager.Instance.ShakeCamera(large); break; } JesterStompCheck.jesterStomped = false; } } }