Decompiled source of Crafting Station Upgrade Extension Radius v1.0.1

CraftingStationExtensionRadius.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("JotunnModStub")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JotunnModStub")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
namespace CraftingStationExtensionRadius;

[BepInPlugin("blumaye.craftingstationextensionradius", "CraftingStationExtensionRadius", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(StationExtension), "Awake")]
	public static class StationExtension_Awake_Prefix
	{
		public static void Prefix(ref float ___m_maxStationDistance)
		{
			___m_maxStationDistance = connectionDistance.Value;
		}
	}

	[HarmonyPatch(typeof(StationExtension), "OtherExtensionInRange")]
	public static class StationExtension_OtherExtensionInRange_Patch
	{
		public static void Postfix(ref bool __result)
		{
			if (disableCollison.Value)
			{
				__result = false;
			}
		}
	}

	public const string PluginGUID = "blumaye.craftingstationextensionradius";

	public const string PluginName = "CraftingStationExtensionRadius";

	public const string PluginVersion = "1.0.0";

	private Harmony harmony = new Harmony("blumaye.craftingstationextensionradius");

	public static ConfigEntry<float> connectionDistance;

	public static ConfigEntry<bool> disableCollison;

	public void Awake()
	{
		((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
		connectionDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Station Extension", "Max connection distance", 30f, "Max connection distance (5f - original game)");
		disableCollison = ((BaseUnityPlugin)this).Config.Bind<bool>("Station Extension", "Removes collision between extension stations", true, "Removes collision between extension stations");
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.PatchAll();
		}
	}

	public void OnDestroy()
	{
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.UnpatchSelf();
		}
	}
}