Decompiled source of HolelessHives v1.1.0

HolelessHives/HolelessHives.dll

Decompiled 11 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
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(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("HolelessHives")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HolelessHives")]
[assembly: AssemblyTitle("HolelessHives")]
[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 HolelessHives
{
	[HarmonyPatch(typeof(RedLocustBees), "Start")]
	internal class BeePatch
	{
		private static bool Prefix(ref RedLocustBees __instance)
		{
			((Renderer)__instance.hivePrefab.GetComponent<MeshRenderer>()).material = Plugin.Bundle.LoadAsset<Material>("Assets/HolelessHives/HiveMaterial.mat");
			return true;
		}
	}
	[HarmonyPatch(typeof(GrabbableObject), "Start")]
	internal class ExistingHivePatch
	{
		private static void Postfix(GrabbableObject __instance)
		{
			if (__instance.itemProperties.itemName == "Hive")
			{
				((Renderer)((Component)__instance).GetComponent<MeshRenderer>()).material = Plugin.Bundle.LoadAsset<Material>("Assets/HolelessHives/HiveMaterial.mat");
			}
		}
	}
	[BepInPlugin("quackandcheese.holelesshives", "HolelessHives", "1.1.0")]
	[BepInProcess("Lethal Company.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public const string ModGUID = "quackandcheese.holelesshives";

		public const string ModName = "HolelessHives";

		public const string ModVersion = "1.1.0";

		public static AssetBundle Bundle;

		public static ConfigFile config;

		public static ManualLogSource logger;

		private void Awake()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			Bundle = QuickLoadAssetBundle("holelesshives.assets");
			logger = ((BaseUnityPlugin)this).Logger;
			config = ((BaseUnityPlugin)this).Config;
			Harmony val = new Harmony("quackandcheese.holelesshives");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HolelessHives is loaded!");
		}

		public static T FindAsset<T>(string name) where T : Object
		{
			return Resources.FindObjectsOfTypeAll<T>().ToList().Find((T x) => ((Object)x).name == name);
		}

		public static AssetBundle QuickLoadAssetBundle(string assetBundleName)
		{
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), assetBundleName);
			return AssetBundle.LoadFromFile(text);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "HolelessHives";

		public const string PLUGIN_NAME = "HolelessHives";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}