Decompiled source of CrucibleAsShovel v1.5.1

CrucibleShovel.dll

Decompiled 9 months ago
using System.Diagnostics;
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("CrucibleShovel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CrucibleShovel")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cf9032c0-fb55-4075-b89d-e71d4d8443c1")]
[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 CrucibleShovel
{
	[BepInPlugin("Ccode.Crucible", "CrucibleShovel", "1.5.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string MyGuid = "Ccode.Crucible";

		private const string PluginName = "CrucibleShovel";

		private const string VersionString = "1.5.1";

		private static readonly Harmony Harmony = new Harmony("Ccode.Crucible");

		public static ManualLogSource Log;

		public static Mesh newModel;

		public static Material newMaterial;

		public void Awake()
		{
			string location = ((BaseUnityPlugin)this).Info.Location;
			string text = "CrucibleShovel.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "crucible";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			newModel = val.LoadAssetWithSubAssets<Mesh>("untitled.obj")[0];
			newMaterial = val.LoadAsset<Material>("Untitled.001");
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"CrucibleShovel 1.5.1 loaded.");
			Log = ((BaseUnityPlugin)this).Logger;
		}
	}
}
namespace CrucibleShovel.Patches
{
	[HarmonyPatch(typeof(GrabbableObject), "Start")]
	internal class ShovelPatch
	{
		public static void Prefix(GrabbableObject __instance)
		{
			if (((object)__instance).GetType() == typeof(Shovel) && (Object)(object)((Component)__instance).gameObject.GetComponentInChildren<ScanNodeProperties>() == (Object)null)
			{
				MeshFilter componentInChildren = ((Component)__instance).gameObject.GetComponentInChildren<MeshFilter>();
				componentInChildren.mesh = Plugin.newModel;
				Renderer componentInChildren2 = (Renderer)(object)((Component)__instance).gameObject.GetComponentInChildren<MeshRenderer>();
				componentInChildren2.material = Plugin.newMaterial;
			}
		}
	}
}