Decompiled source of SCP173Coilhead v1.2.0

scp173.dll

Decompiled a year ago
using 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 Microsoft.CodeAnalysis;
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("LethalCompanyTemplate")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalCompanyTemplate")]
[assembly: AssemblyTitle("LethalCompanyTemplate")]
[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 SCPCoilheadMod
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LethalCompanyTemplate";

		public const string PLUGIN_NAME = "LethalCompanyTemplate";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SCP173
{
	[BepInPlugin("SCP173", "SCP173", "1.1.0")]
	internal class Plugin : BaseUnityPlugin
	{
		public Harmony harmonymain;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			harmonymain = new Harmony("SCP173");
			harmonymain.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SCP173 Loaded.");
		}
	}
}
namespace SCP.Patch
{
	[HarmonyPatch]
	internal class EnemyTypes
	{
		public static GameObject scp173Model;

		[HarmonyPatch(typeof(RoundManager), "BeginEnemySpawning")]
		[HarmonyPostfix]
		public static void SummonSCP(RoundManager __instance)
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: 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)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "scp173.bundle"));
			scp173Model = val.LoadAsset<GameObject>("assets/prefab/default.prefab");
			foreach (SpawnableEnemyWithRarity enemy in RoundManager.Instance.currentLevel.Enemies)
			{
				if ((Object)(object)enemy.enemyType != (Object)null && enemy.enemyType.enemyName == "Spring")
				{
					SpringManAI component = enemy.enemyType.enemyPrefab.GetComponent<SpringManAI>();
					if (!((Object)(object)((Component)component).gameObject.transform.Find("SpringManModel") != (Object)null) || !((Object)(object)((Component)component).gameObject.transform.Find("SpringManModel").Find("Body") != (Object)null) || !((Object)(object)((Component)((Component)component).gameObject.transform.Find("SpringManModel").Find("Body")).gameObject != (Object)null) || !((Object)(object)((Component)((Component)component).gameObject.transform.Find("SpringManModel").Find("Body")).gameObject.GetComponent<SkinnedMeshRenderer>() != (Object)null))
					{
						break;
					}
					Object.Destroy((Object)(object)((Component)((Component)component).gameObject.transform.Find("SpringManModel").Find("Body")).gameObject.GetComponent<SkinnedMeshRenderer>());
					Object.Destroy((Object)(object)((Component)((Component)component).gameObject.transform.Find("SpringManModel").Find("Head")).gameObject.GetComponent<MeshRenderer>());
					Debug.Log((object)"SCP173 Is Now Roaming The Facility");
					scp173Model.transform.SetParent(enemy.enemyType.enemyPrefab.transform, false);
					scp173Model.transform.localPosition = new Vector3(0f, 0f, 0f);
				}
			}
		}
	}
}