Decompiled source of Original Cactus Fruit v2.0.0

PopyModOriginalCactusFruit.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using On;
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("PopyModOriginalCactusFruit")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PopyModOriginalCactusFruit")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("edc6beff-7e7c-48c6-a01b-8661ab556132")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace PopyModOriginalCactusFruit
{
	[BepInPlugin("PopyMod.OriginalCactusFruit", "OriginalCactusFruit", "2.0.0")]
	public class PopyModOriginalCactusFruit : BaseUnityPlugin
	{
		public class PopyModConfig
		{
			public readonly ConfigEntry<string> FruitColour;

			public PopyModConfig(ConfigFile cfg)
			{
				FruitColour = cfg.Bind<string>("General", "Fruit Colour", "#C842DD", "The default value is the colour of the CactusFruit post \"Seismic Shift\" and pre \"Welcome Wormlings\" updates");
			}
		}

		private const string modGUID = "PopyMod.OriginalCactusFruit";

		private const string modName = "OriginalCactusFruit";

		private const string modVersion = "2.0.0";

		internal static ManualLogSource Log;

		internal static PopyModConfig ModConfig { get; private set; }

		private void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			Log = Logger.CreateLogSource("PopyMod.OriginalCactusFruit");
			((BaseUnityPlugin)this).Logger.LogWarning((object)"\r\n   ,-.   \r\n _(*_*)_         PopyMod\r\n(_  o  _)  Original Cactus Fruit\r\n  / o \\       2.0.0  loaded\r\n (_/ \\_)");
			MapBuilder.Start += new hook_Start(PPMapBuilderStart);
			ModConfig = new PopyModConfig(((BaseUnityPlugin)this).Config);
		}

		private void PPMapBuilderStart(orig_Start orig, MapBuilder self)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			((Renderer)self.cactusFruitPrefab.GetComponentInChildren<MeshRenderer>()).material.SetVector("_MainColor", GetFruitColor());
		}

		private Vector4 GetFruitColor()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			Color val = default(Color);
			ColorUtility.TryParseHtmlString(ModConfig.FruitColour.Value, ref val);
			Vector4 result = default(Vector4);
			((Vector4)(ref result))..ctor(val.r, val.g, val.b, val.a);
			return result;
		}
	}
}