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 StinkyEnemy v1.0.0
StinkyProjectAttempt2.dll
Decompiled a year agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; 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("StinkyEnemyPlugin")] [assembly: AssemblyDescription("A plugin made for R.E.P.O. requires BepInEx and RepoLib")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("StinkyEnemyPlugin")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7a38e5b0-3017-4c5f-9f17-502058a1a921")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace StinkyEnemy; [BepInPlugin("LnadoZor.StinkyEnemy", "Stinky Enemy", "1.0.0")] public class StinkyEnemyBase : BaseUnityPlugin { private const string modUID = "LnadoZor.StinkyEnemy"; private const string modName = "Stinky Enemy"; private const string modVersion = "1.0.0"; internal static StinkyEnemyBase instance; internal ManualLogSource logger; private static Mesh StinkyBody; private static Texture2D StinkyTexture; private readonly Harmony harmony = new Harmony("LnadoZor.StinkyEnemy"); private void Awake() { logger = ((BaseUnityPlugin)this).Logger; logger.LogInfo((object)"Loading Stinky Enemy mod..."); if ((Object)(object)instance == (Object)null) { instance = this; harmony.PatchAll(); string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(directoryName, "stinky_assets")); if ((Object)(object)val == (Object)null) { logger.LogError((object)"Failed to load asset bundle!"); return; } GameObject val2 = val.LoadAsset<GameObject>("stinkmodel"); if ((Object)(object)val2 == (Object)null) { logger.LogError((object)"Failed to load 'stinkmodel.fbx' from asset bundle!"); return; } MeshFilter componentInChildren = val2.GetComponentInChildren<MeshFilter>(); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.sharedMesh != (Object)null) { StinkyBody = componentInChildren.sharedMesh; StinkyTexture = val.LoadAsset<Texture2D>("stinkyTexture"); if ((Object)(object)StinkyTexture == (Object)null) { logger.LogError((object)"Failed to load 'stinkyTexture.png'!"); } else { logger.LogInfo((object)"Successfully loaded assets for Stinky Enemy mod!"); } } else { logger.LogError((object)"Failed to extract mesh from stinkmodel.fbx!"); } } else { Object.Destroy((Object)(object)this); } } private static void DisableMeshRenderersExcept(Transform parent) { if ((Object)(object)parent == (Object)null) { instance.logger.LogError((object)"Parent transform is null!"); return; } Transform[] componentsInChildren = ((Component)parent).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (!(((Object)val).name == "Head Top") && !(((Object)val).name == "Head Top_Mouth Half Open")) { MeshRenderer component = ((Component)val).GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; } } } } public static void ModifyEnemyHead(GameObject enemyHead) { Transform val = enemyHead.transform.Find("Enable/Mesh/Animation System/Main Animation/Top Mesh/Offset/Top Animation/Mesh/Enemy Head Top - Idle/Head Top"); Transform val2 = enemyHead.transform.Find("Enable/Mesh/Animation System/Main Animation/Top Mesh/Offset/Top Animation/Mesh/Enemy Head Top - Chase/Headman_Mouth Half Open/Head Top_Mouth Half Open"); if ((Object)(object)val == (Object)null) { instance.logger.LogError((object)"Head Top object not found!"); return; } ModifyMeshAndMaterial(val); if ((Object)(object)val2 == (Object)null) { instance.logger.LogError((object)"Head Top_Mouth Half Open object not found!"); } else { ModifyMeshAndMaterial(val2); } Transform parent = val.parent; Transform val3 = ((parent != null) ? parent.parent : null); if ((Object)(object)val3 == (Object)null) { instance.logger.LogError((object)"Head Top's parent parent is null!"); return; } DisableMeshRenderersExcept(val3); instance.logger.LogInfo((object)"Finished modifying enemy head."); } private static void ModifyMeshAndMaterial(Transform target) { //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { return; } MeshFilter component = ((Component)target).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null) { component.mesh = StinkyBody; } else { instance.logger.LogError((object)("MeshFilter not found on " + ((Object)target).name + "!")); } MeshRenderer component2 = ((Component)target).GetComponent<MeshRenderer>(); if ((Object)(object)component2 != (Object)null) { Material sharedMaterial = ((Renderer)component2).sharedMaterial; if ((Object)(object)sharedMaterial != (Object)null) { if (sharedMaterial.HasProperty("_AlbedoTexture")) { sharedMaterial.SetTexture("_AlbedoTexture", (Texture)(object)StinkyTexture); } else if (sharedMaterial.HasProperty("_MainTex")) { sharedMaterial.SetTexture("_MainTex", (Texture)(object)StinkyTexture); } if (sharedMaterial.HasProperty("_NormalStrength")) { sharedMaterial.SetFloat("_NormalStrength", 0f); } } else { instance.logger.LogError((object)("Material not found on " + ((Object)target).name + "!")); } } else { instance.logger.LogError((object)("MeshRenderer not found on " + ((Object)target).name + "!")); } target.localPosition = new Vector3(0f, -0.08f, -2.23f); target.localRotation = Quaternion.Euler(-90f, 0f, 180f); target.localScale = new Vector3(40f, 40f, 40f); } public static void ModifyBotMeshes(GameObject enemyHead) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) Transform val = enemyHead.transform.Find("Enable/Mesh/Animation System/Main Animation/Bot Mesh/Offset/Bot Animation/Mesh"); if ((Object)(object)val == (Object)null) { instance.logger.LogError((object)"Bot Mesh object not found!"); return; } Transform val2 = val.Find("Enemy Head Bot - Idle"); if ((Object)(object)val2 != (Object)null) { foreach (Transform item in val2) { Transform val3 = item; MeshRenderer component = ((Component)val3).GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; } } } else { instance.logger.LogError((object)"'Enemy Head Bot - Idle' object not found under Bot Mesh!"); } int num = 0; foreach (Transform item2 in val) { Transform val4 = item2; if (((Object)val4).name != "Enemy Head Bot - Idle") { val4.localPosition += new Vector3(0.02f, 0f, 0.335f); num++; } } } } [HarmonyPatch(typeof(EnemyHeadController), "Awake")] public class Patch_EnemyHeadController { [HarmonyPostfix] public static void Postfix(EnemyHeadController __instance) { if ((Object)(object)__instance == (Object)null) { StinkyEnemyBase.instance.logger.LogError((object)"EnemyHeadController instance is null!"); return; } Transform parent = ((Component)__instance).transform.parent; object obj; if (parent == null) { obj = null; } else { Transform parent2 = parent.parent; obj = ((parent2 != null) ? ((Component)parent2).gameObject : null); } GameObject val = (GameObject)obj; if ((Object)(object)val == (Object)null) { StinkyEnemyBase.instance.logger.LogError((object)"Enemy head parent is null!"); return; } StinkyEnemyBase.ModifyEnemyHead(val); StinkyEnemyBase.ModifyBotMeshes(val); } }