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 GashlysGash v0.0.1
Gashly.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; 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 BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("OmniBrackenMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("OmniBrackenMod")] [assembly: AssemblyTitle("OmniBrackenMod")] [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 OmniBrackenMod { public static class ConfigSettings { public static ConfigEntry<float> AudioDistance; public static ConfigEntry<float> Speed; public static ConfigEntry<float> StandupTime; public static ConfigEntry<float> StalkAudioIntervalMin; public static ConfigEntry<float> StalkAudioIntervalMax; public static void BindConfigSettings() { AudioDistance = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("OmniBrackenMod", "Custom Audio Distance", 30f, "Distance Omni-Man's audio travels. (Vanilla is ~20)"); Speed = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("OmniBrackenMod", "Chase Speed", 22f, "The speed at which Omni-Man chases you when provoked. (Vanilla is 9)"); StandupTime = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("OmniBrackenMod", "Standup Time", 0.5f, "The time it takes Omni-Man to stand back up when you catch him stalking."); StalkAudioIntervalMin = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("OmniBrackenMod", "Stalk Audio Interval Min", 5f, "The minimum time Omni-Man will wait to let you know he's stalking you."); StalkAudioIntervalMax = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("OmniBrackenMod", "Stalk Audio Interval Max", 13f, "The maximum time Omni-Man will wait to let you know he's stalking you."); } } [BepInPlugin("OmniBrackenMod", "OmniBrackenMod", "1.0.0")] public class Plugin : BaseUnityPlugin { public static AudioClip AngerVoice; public static AudioClip CaughtVoice; public static AudioClip CrackNeckAudio; public static AudioClip StunSFX; public static GameObject StalkAudio; public static GameObject StandPrefab; public static GameObject MadPrefab; public static VideoClip TerminalVideo; public static TextAsset TerminalText; public static Texture2D GashlyStanding; public static Texture2D GashlyAngry; public static Texture2D GashlyAngryEmission; public static Texture2D GashlyStandingEmission; public static Plugin Instance; private Harmony _harmonyMain; private static Texture2D LoadTexture(string filePath) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown Texture2D val = new Texture2D(2, 4); if (File.Exists(filePath)) { byte[] array = File.ReadAllBytes(filePath); if (ImageConversion.LoadImage(val, array)) { val.Apply(); return val; } } return null; } private void Awake() { //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown Debug.LogError((object)Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "omnibracken")); AssetBundle obj = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "omnibracken")); AngerVoice = obj.LoadAsset<AudioClip>("assets/Anger Voice.mp3"); MadPrefab = obj.LoadAsset<GameObject>("assets/OmniMadBracken.prefab"); StandPrefab = obj.LoadAsset<GameObject>("assets/OmniNormalBracken.prefab"); TerminalText = obj.LoadAsset<TextAsset>("assets/OmniManDescription.txt"); TerminalVideo = obj.LoadAsset<VideoClip>("assets/Terminal Video.mp4"); StalkAudio = obj.LoadAsset<GameObject>("assets/StalkSource.prefab"); CaughtVoice = obj.LoadAsset<AudioClip>("assets/VineBoom.mp3"); StunSFX = obj.LoadAsset<AudioClip>("assets/Stun.mp3"); CrackNeckAudio = obj.LoadAsset<AudioClip>("assets/Jumpscare.mp3"); string filePath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "gashly2.png"); string filePath2 = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "gashly.png"); string filePath3 = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "gashly2-emission.png"); string filePath4 = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "gashly-emission.png"); GashlyAngry = LoadTexture(filePath); GashlyStanding = LoadTexture(filePath2); GashlyAngryEmission = LoadTexture(filePath3); GashlyStandingEmission = LoadTexture(filePath4); Instance = this; ConfigSettings.BindConfigSettings(); _harmonyMain = new Harmony("OmniBrackenMod"); _harmonyMain.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin OmniBrackenMod is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "OmniBrackenMod"; public const string PLUGIN_NAME = "OmniBrackenMod"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace OmniBrackenMod.Patches { [HarmonyPatch(typeof(EnemyAI))] public class EnemyAIPatches { [HarmonyPatch("SwitchToBehaviourStateOnLocalClient")] [HarmonyPostfix] public static void SwitchToBehaviorStateOnLocalClientPatch(EnemyAI __instance, int stateIndex) { FlowermanAI val = (FlowermanAI)(object)((__instance is FlowermanAI) ? __instance : null); if (val != null) { switch (stateIndex) { case 0: ((MonoBehaviour)val).StopAllCoroutines(); ((MonoBehaviour)val).StartCoroutine(FlowermanAIPatches.Stalk(val)); FlowermanAIPatches.Anger(val); break; case 1: FlowermanAIPatches.Mute(val); ((MonoBehaviour)val).StopAllCoroutines(); ((MonoBehaviour)val).StartCoroutine(FlowermanAIPatches.Stand(val)); break; case 2: FlowermanAIPatches.Mute(val); ((MonoBehaviour)val).StopAllCoroutines(); FlowermanAIPatches.Anger(val); break; } } } } [HarmonyPatch(typeof(FlowermanAI))] public class FlowermanAIPatches { private class FlowermanExtras { public GameObject Model; public AudioSource StalkAudioSource; public FlowermanExtras(GameObject newModel, AudioSource newStalkAudioSource) { Model = newModel; StalkAudioSource = newStalkAudioSource; } } private static Dictionary<FlowermanAI, FlowermanExtras> _omniManMap = new Dictionary<FlowermanAI, FlowermanExtras>(); [HarmonyPatch("Start")] [HarmonyPostfix] public static void StartPatch(FlowermanAI __instance) { _omniManMap.Add(__instance, new FlowermanExtras(null, Object.Instantiate<GameObject>(Plugin.StalkAudio, ((Component)__instance).gameObject.transform).GetComponent<AudioSource>())); __instance.creatureAngerVoice.clip = Plugin.AngerVoice; __instance.crackNeckSFX = Plugin.CrackNeckAudio; __instance.crackNeckAudio.clip = Plugin.CrackNeckAudio; ((EnemyAI)__instance).enemyType.stunSFX = Plugin.StunSFX; ((EnemyAI)__instance).enemyBehaviourStates[1].VoiceClip = Plugin.CaughtVoice; __instance.creatureAngerVoice.maxDistance = ConfigSettings.AudioDistance.Value; __instance.crackNeckAudio.maxDistance = ConfigSettings.AudioDistance.Value; ((EnemyAI)__instance).creatureSFX.maxDistance = ConfigSettings.AudioDistance.Value; ((EnemyAI)__instance).creatureVoice.maxDistance = ConfigSettings.AudioDistance.Value; ((Component)((Component)__instance).gameObject.transform.Find("ScanNode")).GetComponent<ScanNodeProperties>().headerText = "Gashly"; Object.Destroy((Object)(object)((Component)((Component)__instance).gameObject.transform.Find("FlowermanModel").Find("LOD1")).gameObject.GetComponent<SkinnedMeshRenderer>()); Object.Destroy((Object)(object)((Component)((Component)__instance).gameObject.transform.Find("FlowermanModel").Find("AnimContainer").Find("metarig")).gameObject); __instance.EnterAngerModeServerRpc(0f); __instance.EnterAngerModeClientRpc(0f); ((MonoBehaviour)__instance).StartCoroutine(Stand(__instance)); } [HarmonyPatch("EnterAngerModeClientRpc")] [HarmonyPostfix] public static void EnterAngerModeClientRPCPatch(FlowermanAI __instance) { ((EnemyAI)__instance).agent.speed = ConfigSettings.Speed.Value; } [HarmonyPatch("Update")] [HarmonyPostfix] public static void Update(FlowermanAI __instance) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)StartOfRound.Instance.localPlayerController.gameplayCamera).transform; MeshFilter component = ((Component)__instance).GetComponent<MeshFilter>(); if (!((Object)(object)component != (Object)null)) { return; } Mesh mesh = component.mesh; if ((Object)(object)mesh != (Object)null) { Vector3[] array = (Vector3[])(object)new Vector3[mesh.vertexCount]; Vector3 val = new Vector3(transform.position.x, transform.position.y, ((Component)__instance).transform.position.z - 3f) - ((Component)__instance).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; for (int i = 0; i < array.Length; i++) { array[i] = normalized; } mesh.normals = array; } } [HarmonyPatch("KillEnemy")] [HarmonyPostfix] public static void KillEnemyPatch(FlowermanAI __instance) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) Mute(__instance); ((MonoBehaviour)__instance).StopAllCoroutines(); _omniManMap[__instance].Model.transform.eulerAngles = new Vector3(90f, 0f, 0f); Transform transform = _omniManMap[__instance].Model.transform; transform.localPosition += new Vector3(0f, -1.45f, 0f); } [HarmonyPatch("KillPlayerAnimationClientRpc")] [HarmonyPostfix] public static void KillPlayerAnimationClientRpcPatch(FlowermanAI __instance, int playerObjectId) { ((Component)StartOfRound.Instance.allPlayerScripts[playerObjectId].gameplayCamera).transform.LookAt(((Component)__instance).transform); } public static void Anger(FlowermanAI __instance) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(Plugin.MadPrefab, ((Component)__instance).gameObject.transform); val.transform.localPosition = new Vector3(0f, 1.5f, 0f); Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] materials = componentsInChildren[i].materials; foreach (Material val2 in materials) { Debug.LogError((object)("MatName: " + ((Object)val2).name)); if (((Object)val2).name.StartsWith("OmniMadMat")) { val2.mainTexture = (Texture)(object)Plugin.GashlyAngry; if (val2.HasProperty("_EmissiveColorMap")) { val2.SetTexture("_EmissiveColorMap", (Texture)(object)Plugin.GashlyAngryEmission); } } } } if (Object.op_Implicit((Object)(object)_omniManMap[__instance].Model)) { Object.Destroy((Object)(object)_omniManMap[__instance].Model); } _omniManMap[__instance].Model = val; } public static IEnumerator Stand(FlowermanAI __instance) { yield return (object)new WaitForSeconds(ConfigSettings.StandupTime.Value); GameObject val = Object.Instantiate<GameObject>(Plugin.StandPrefab, ((Component)__instance).gameObject.transform); val.transform.localPosition = new Vector3(0f, 1.5f, 0f); Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] materials = componentsInChildren[i].materials; foreach (Material val2 in materials) { Debug.LogError((object)("MatName: " + ((Object)val2).name)); if (((Object)val2).name.StartsWith("OmniNormalMat")) { val2.mainTexture = (Texture)(object)Plugin.GashlyStanding; if (val2.HasProperty("_EmissiveColorMap")) { val2.SetTexture("_EmissiveColorMap", (Texture)(object)Plugin.GashlyStandingEmission); } } } } if (Object.op_Implicit((Object)(object)_omniManMap[__instance].Model)) { Object.Destroy((Object)(object)_omniManMap[__instance].Model); } _omniManMap[__instance].Model = val; } public static IEnumerator Stalk(FlowermanAI __instance) { AudioSource stalkAudio = _omniManMap[__instance].StalkAudioSource; while (true) { stalkAudio.Play(); yield return (object)new WaitForSeconds(stalkAudio.clip.length + (float)new Random().NextDouble() * (ConfigSettings.StalkAudioIntervalMax.Value - ConfigSettings.StalkAudioIntervalMin.Value) + ConfigSettings.StalkAudioIntervalMin.Value); } } public static void Mute(FlowermanAI __instance) { _omniManMap[__instance].StalkAudioSource.Stop(); } } [HarmonyPatch(typeof(Terminal))] public class TerminalPatches { [HarmonyPatch("BeginUsingTerminal")] [HarmonyPostfix] public static void BeginUsingTerminalPatch(Terminal __instance) { __instance.terminalNodes.allKeywords[36].word = "omni-man"; __instance.enemyFiles[1].creatureName = "Omni-Man"; __instance.enemyFiles[1].displayVideo = Plugin.TerminalVideo; __instance.enemyFiles[1].displayText = Plugin.TerminalText.text; } } }