Decompiled source of BeltHub2x2 v1.0.0

BeltHub2x2.dll

Decompiled 3 weeks ago
using System;
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;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BeltHub2x2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BeltHub2x2")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ac6f0f80-7ac9-4cfb-9b5e-7ee220175ce5")]
[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 Jinx666.BeltHub2x2;

[BepInPlugin("jinx666.techtonica.belthub2x2", "Belt Hub 2x2", "1.0")]
public class Patch : BaseUnityPlugin
{
	public const string pluginGuid = "jinx666.techtonica.belthub2x2";

	public const string pluginName = "Belt Hub 2x2";

	public const string pluginVersion = "1.0";

	private static ManualLogSource _Logger;

	public void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Expected O, but got Unknown
		_Logger = ((BaseUnityPlugin)this).Logger;
		Harmony val = new Harmony("jinx666.techtonica.belthub2x2");
		MethodInfo methodInfo = AccessTools.Method(typeof(ConveyorInstance), "RefreshShape", (Type[])null, (Type[])null);
		MethodInfo methodInfo2 = AccessTools.Method(typeof(Patch), "Postfix", (Type[])null, (Type[])null);
		val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
	}

	public static void Postfix(ref ConveyorInstance __instance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Invalid comparison between Unknown and I4
		if ((int)__instance.beltShape == 5)
		{
			__instance.beltSpeed = __instance._myDef.runtimeSettings.beltSpeed * 2f;
		}
		else
		{
			__instance.beltSpeed = __instance._myDef.runtimeSettings.beltSpeed;
		}
	}
}