Decompiled source of SpamtomCoilhead v1.0.0

Spamtom.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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("Spamtom")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Spamtom")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fe0f963e-fdc5-48b4-acab-88a35fc27c18")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Spamtom
{
	[BepInPlugin("Spamtom", "Spamtom", "1.0.0")]
	public class SpamtomSpring : BaseUnityPlugin
	{
		public static GameObject Visuals;

		public static AssetBundle AssetBundle { get; private set; }

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Spamtom is loaded!");
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			if ((Object)(object)AssetBundle != (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Attempted to load the asset bundle but the bundle was not null!");
				return;
			}
			AssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "spam"));
			Visuals = AssetBundle.LoadAsset<GameObject>("assets/Mods/Spam.prefab");
			Renderer[] componentsInChildren = Visuals.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				((Component)val).gameObject.layer = LayerMask.NameToLayer("Enemies");
			}
		}
	}
}
namespace Spamtom.Patches
{
	[HarmonyPatch(typeof(EnemyAI), "Start")]
	internal class SpringmanPatch
	{
		private static void Postfix(EnemyAI __instance)
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			if (__instance is SpringManAI)
			{
				Transform val = ((Component)__instance).transform.Find("SpringManModel");
				SkinnedMeshRenderer val2 = (((Object)(object)val != (Object)null) ? ((Component)val.Find("Body")).GetComponent<SkinnedMeshRenderer>() : null);
				((Renderer)val2).enabled = false;
				MeshRenderer component = ((Component)val.Find("Head")).GetComponent<MeshRenderer>();
				Transform val3 = val.Find("AnimContainer").Find("metarig");
				((Renderer)component).enabled = false;
				GameObject val4 = Object.Instantiate<GameObject>(SpamtomSpring.Visuals);
				val4.transform.SetParent(val);
				val4.transform.localPosition = Vector3.zero;
				val4.transform.localRotation = Quaternion.identity;
				val4.transform.localScale = Vector3.one * 0.4f;
			}
		}
	}
}