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 BrackenDanceMod v1.1.0
BrackenDance.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using BrackenDance.Patches; using HarmonyLib; using Microsoft.CodeAnalysis; 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 = ".NET Standard 2.1")] [assembly: AssemblyCompany("BrackenDance")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A Mod to dance with the bracken while playing music from a boombox")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("BrackenDance")] [assembly: AssemblyTitle("BrackenDance")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.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 BrackenDance { [BepInPlugin("FloraMemori.BrackenDanceMod", "Bracken Dance", "1.1.0")] public class BrackenDanceMod : BaseUnityPlugin { private const string modGUID = "FloraMemori.BrackenDanceMod"; private const string modName = "Bracken Dance"; private const string modVersion = "1.1.0"; private readonly Harmony harmony = new Harmony("FloraMemori.BrackenDanceMod"); private static BrackenDanceMod Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("FloraMemori.BrackenDanceMod"); mls.LogInfo((object)"Bracken Dance loaded"); harmony.PatchAll(typeof(BrackenDanceMod)); harmony.PatchAll(typeof(FlowerManAIPatch)); harmony.PatchAll(typeof(EnemyAIPatch)); } } public static class PluginInfo { public const string PLUGIN_GUID = "BrackenDance"; public const string PLUGIN_NAME = "BrackenDance"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace BrackenDance.Patches { [HarmonyPatch(typeof(EnemyAI))] internal class EnemyAIPatch { [HarmonyPatch("DetectNoise")] [HarmonyPrefix] public static void EnemyDetectNoisePatch(ref Vector3 noisePosition, ref float noiseLoudness, ref int timesPlayedInOneSpot, ref int noiseID, EnemyAI __instance) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!(__instance is FlowermanAI)) { return; } FlowermanAI val = (FlowermanAI)__instance; if (noiseID != 5 || !(Vector3.Distance(((Component)val).transform.position, noisePosition) < 30f)) { return; } if (((EnemyAI)val).currentBehaviourStateIndex != 3) { ((EnemyAI)val).SwitchToBehaviourStateOnLocalClient(3); } val.angerMeter = 2f; if (((NetworkBehaviour)val).IsOwner) { Transform val2 = ((EnemyAI)val).ChooseClosestNodeToPosition(noisePosition, false, 0); if ((Object)(object)val2 != (Object)null) { ((EnemyAI)val).targetNode = val2; ((EnemyAI)val).SetDestinationToPosition(((EnemyAI)val).targetNode.position, false); } } } } [HarmonyPatch(typeof(FlowermanAI))] internal class FlowerManAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StartPatch(FlowermanAI __instance) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown EnemyBehaviourState[] enemyBehaviourStates = ((EnemyAI)__instance).enemyBehaviourStates; ((EnemyAI)__instance).enemyBehaviourStates = (EnemyBehaviourState[])(object)new EnemyBehaviourState[4]; for (int i = 0; i < enemyBehaviourStates.Length; i++) { ((EnemyAI)__instance).enemyBehaviourStates[i] = enemyBehaviourStates[i]; } EnemyBehaviourState val = new EnemyBehaviourState(); val.name = "Dance State"; val.playOneShotVoice = false; val.playOneShotSFX = false; val.parameterString = "BrackenDance"; val.VoiceClip = null; ((EnemyAI)__instance).enemyBehaviourStates[3] = val; } [HarmonyPatch("DoAIInterval")] [HarmonyPostfix] public static void DoAIIntervalPatch(FlowermanAI __instance) { if (((EnemyAI)__instance).currentBehaviourStateIndex == 3 && __instance.angerMeter <= 0f) { ((EnemyAI)__instance).SwitchToBehaviourStateOnLocalClient(0); } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void UpdatePatch(FlowermanAI __instance) { if (((EnemyAI)__instance).currentBehaviourStateIndex == 3) { __instance.angerMeter -= Time.deltaTime; } } [HarmonyPatch("OnCollideWithPlayer")] [HarmonyPrefix] public static bool OnCollideWithPlayerPatch(FlowermanAI __instance) { if (((EnemyAI)__instance).currentBehaviourStateIndex == 3) { return false; } return true; } } }