Decompiled source of Structure Outlines v2.1.0

Mods/StructureOutlines.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using Il2CppRUMBLE.MoveSystem;
using MelonLoader;
using Microsoft.CodeAnalysis;
using StructureOutlines;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::StructureOutlines.StructureOutlines), "StructureOutlines", "2.1.0", "yiak65", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("StructureOutlines")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StructureOutlines")]
[assembly: AssemblyTitle("StructureOutlines")]
[assembly: NeutralResourcesLanguage("en-US")]
[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 StructureOutlines
{
	public class StructureOutlines : MelonMod
	{
		public OutlineHandler outlines;

		public override void OnLateInitializeMelon()
		{
			outlines = new OutlineHandler();
			outlines.Init();
		}
	}
	public class OutlineHandler : MonoBehaviour
	{
		[HarmonyPatch(typeof(Structure), "OnFetchFromPool")]
		public class StructureSpawnPatch
		{
			private static void Postfix(Structure __instance)
			{
				if (((Component)__instance).transform.childCount >= 3)
				{
					return;
				}
				if (((Component)__instance).transform.childCount > 0)
				{
					switch (((Object)((Component)__instance).transform.GetChild(0)).name)
					{
					case "Mesh":
					case "Structure_Disc":
					case "Ball":
						Outlines.OutlineStructure(((Component)((Component)__instance).transform.GetChild(0)).gameObject);
						break;
					case "Ballcage":
					case "Cubecage":
					case "Wallcage":
						Outlines.OutlineStructure(((Component)__instance).gameObject);
						Outlines.OutlineStructure(((Component)((Component)__instance).transform.GetChild(0)).gameObject);
						break;
					}
					if (((Component)__instance).transform.childCount > 1)
					{
						string name = ((Object)((Component)__instance).transform.GetChild(1)).name;
						string text = name;
						if (text == "Diskcage" || text == "Ballcage")
						{
							Outlines.OutlineStructure(((Component)__instance).gameObject);
							Outlines.OutlineStructure(((Component)((Component)__instance).transform.GetChild(0)).gameObject);
						}
					}
				}
				else
				{
					Outlines.OutlineStructure(((Component)__instance).gameObject);
				}
			}
		}

		private Color black;

		private Shader unlit;

		public static OutlineHandler Outlines;

		public void OutlineStructure(GameObject structure)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			if (structure.transform.childCount < 4)
			{
				MelonLogger.Msg("Outlining structure");
				GameObject val = new GameObject();
				((Object)val).name = "Structure Outline";
				val.transform.parent = structure.transform;
				val.AddComponent<MeshFilter>().mesh = structure.GetComponent<MeshFilter>().mesh;
				val.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
				val.transform.localScale = new Vector3(1.05f, 1.05f, 1.05f);
				MeshRenderer val2 = val.AddComponent<MeshRenderer>();
				((Renderer)val2).material.shader = unlit;
				((Renderer)val2).material.color = black;
				((Renderer)val2).material.SetFloat("_Cull", 1f);
			}
		}

		public void Init()
		{
			//IL_0027: 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)
			Outlines = this;
			unlit = Shader.Find("Universal Render Pipeline/Unlit");
			black = new Color(0f, 0f, 0f);
		}
	}
}