Decompiled source of Better Trains v1.0.1

BetterTrain.dll

Decompiled a week ago
using System;
using System.Diagnostics;
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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mirror;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BetterTrain")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterTrain")]
[assembly: AssemblyTitle("BetterTrain")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 highspeedtrain
{
	[BepInPlugin("bayturtleking.bettertrains", "BetterTrains", "1.0.0")]
	public class fasttrainmod : BasePlugin
	{
		public const string ourguiddd = "bayturtleking.bettertrains";

		internal static fasttrainmod instance;

		internal static ConfigEntry<float> howmuchfasteristrain;

		public override void Load()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			instance = this;
			howmuchfasteristrain = ((BasePlugin)this).Config.Bind<float>("General", "Train_speed_multiplier", 4f, "(host only) how much faster the train is, 1 is vanilla but 4 is the mod default");
			new Harmony("bayturtleking.bettertrains").PatchAll();
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(40, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("better train mod by bayturtleking loaded");
			}
			log.LogInfo(val);
		}
	}
	[HarmonyPatch(typeof(NetworkedTrain), "Awake")]
	internal static class doitonstart
	{
		[HarmonyPostfix]
		private static void postfix(NetworkedTrain __instance)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			if (!((Object)(object)__instance == (Object)null) && NetworkServer.active)
			{
				float value = fasttrainmod.howmuchfasteristrain.Value;
				__instance.fullSpeed *= value;
				ManualLogSource log = ((BasePlugin)fasttrainmod.instance).Log;
				bool flag = default(bool);
				BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(32, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("better trains made trains faster");
				}
				log.LogDebug(val);
			}
		}
	}
}