Please disclose if your mod was created primarily 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 SonicThumper v1.0.2
SonicThumper.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Unity.Netcode; 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 = "")] [assembly: AssemblyCompany("SonicThumper")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Sonic SFX and Model mod for Thumper enemy.")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("SonicThumper")] [assembly: AssemblyTitle("SonicThumper")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] namespace SonicThumper { [BepInPlugin("SonicThumper", "SonicThumper", "1.0.1")] public class Plugin : BaseUnityPlugin { public static AudioClip BiteAudio; public static AudioClip AngeredAudio; public static GameObject SonicModel; public static string pluginDir; public static AssetBundle SonicBundle; private void Awake() { pluginDir = ((BaseUnityPlugin)this).Info.Location; LoadAssets(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"SonicThumper: Plugin loaded."); } private void LoadAssets() { try { SonicBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(pluginDir), "sonic")); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("SonicThumper: AssetBundle failed to load -- " + ex.Message)); return; } try { AngeredAudio = SonicBundle.LoadAsset<AudioClip>("SonicBassBoosted.wav"); SonicModel = SonicBundle.LoadAsset<GameObject>("SonicModel2.prefab"); BiteAudio = SonicBundle.LoadAsset<AudioClip>("SonicRingSound.wav"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"SonicThumper: Successfully loaded assets."); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("SonicThumper: Failed to load assets -- " + ex2.Message)); } } } public static class PluginInfo { public const string PLUGIN_GUID = "SonicThumper"; public const string PLUGIN_NAME = "SonicThumper"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace SonicThumper.Patches { [HarmonyPatch(typeof(CrawlerAI))] internal class SonicThumperPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void SummonSonic(CrawlerAI __instance) { Transform transform = ((Component)__instance).transform; Renderer[] componentsInChildren = ((Component)transform).GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Debug.Log((object)val); val.enabled = false; } InstantiateSonic(transform); __instance.bitePlayerSFX = Plugin.BiteAudio; } private static void InstantiateSonic(Transform parent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)Plugin.SonicModel == (Object)null)) { GameObject val = Object.Instantiate<GameObject>(Plugin.SonicModel); val.transform.SetParent(parent); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; val.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); ((Renderer)val.GetComponentInChildren<MeshRenderer>()).enabled = true; Debug.Log((object)("Sonic Instance: " + (object)val)); } } [HarmonyPatch("BeginChasingPlayerClientRpc")] [HarmonyPostfix] [ClientRpc] private static void StartSonicSound(CrawlerAI __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if (!((Object)Plugin.AngeredAudio == (Object)null)) { ((EnemyAI)__instance).creatureSFX.PlayOneShot(Plugin.AngeredAudio, 0.6f); WalkieTalkie.TransmitOneShotAudio(((EnemyAI)__instance).creatureSFX, Plugin.AngeredAudio, 0.6f); } } [HarmonyPatch("EatPlayerBodyClientRpc")] [HarmonyPostfix] [ClientRpc] public static void StopSonicSound(CrawlerAI __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if (!((Object)Plugin.AngeredAudio == (Object)null) && ((EnemyAI)__instance).creatureSFX.isPlaying) { ((EnemyAI)__instance).creatureSFX.Stop(); } } } }