Decompiled source of SnowyWeeds v1.3.3

SnowyWeeds.dll

Decompiled 3 hours 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 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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SnowyWeeds")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Makes Vain Shrouds snowy on snowy moons.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SnowyWeeds")]
[assembly: AssemblyTitle("SnowyWeeds")]
[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 SnowyWeeds
{
	[BepInPlugin("dopadream.lethalcompany.SnowyWeeds", "Snowy Weeds", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch]
		private class SnowyWeedPatches
		{
			[HarmonyPatch(typeof(MoldSpreadManager), "GenerateMold")]
			[HarmonyPostfix]
			private static void PostSpreadMold(MoldSpreadManager __instance)
			{
				Logger.LogDebug((object)"PostSpreadMold() called");
				if (!IsSnowLevel() || (Object)(object)StartOfRound.Instance == (Object)null)
				{
					return;
				}
				for (int i = 0; i < __instance.moldContainer.childCount; i++)
				{
					Renderer[] componentsInChildren = ((Component)__instance.moldContainer).GetComponentsInChildren<Renderer>();
					foreach (Renderer val in componentsInChildren)
					{
						val.material.mainTexture = weedTexture;
					}
				}
			}
		}

		private const string PLUGIN_GUID = "dopadream.lethalcompany.SnowyWeeds";

		private const string PLUGIN_NAME = "Snowy Weeds";

		private const string PLUGIN_VERSION = "1.0.0";

		internal static ManualLogSource Logger;

		internal static Texture weedTexture;

		internal static Texture weedParticle;

		private void Awake()
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			try
			{
				AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "snowyweeds"));
				Object obj = val.LoadAsset("InvasiveWeedSnowy", typeof(Texture));
				weedTexture = (Texture)(object)((obj is Texture) ? obj : null);
				Object obj2 = val.LoadAsset("InvasiveWeedSnowy 1", typeof(Texture));
				weedParticle = (Texture)(object)((obj2 is Texture) ? obj2 : null);
			}
			catch
			{
				Logger.LogError((object)"Encountered some error loading asset bundle. Did you install the plugin correctly?");
				return;
			}
			new Harmony("dopadream.lethalcompany.SnowyWeeds").PatchAll();
			Logger.LogInfo((object)"Snowy Weeds v1.0.0 loaded");
		}

		private static bool IsSnowLevel()
		{
			return StartOfRound.Instance.currentLevel.levelIncludesSnowFootprints;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "SnowyWeeds";

		public const string PLUGIN_NAME = "SnowyWeeds";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}