Decompiled source of CruiserMap v1.0.0

CruiserMap.dll

Decompiled 4 days ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using CruiserMap.Patches;
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: AssemblyTitle("RadiationIsCool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RadiationIsCool")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8ee335db-0cbe-470c-8fbc-69263f01b35a")]
[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: 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 CruiserMap
{
	[BepInPlugin("Piggy.CruiserMap", "CruiserMap", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "Piggy.CruiserMap";

		private const string modName = "CruiserMap";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Piggy.CruiserMap");

		private static Plugin Instance;

		public static ManualLogSource mls;

		public static AssetBundle Bundle;

		public static string PluginDirectory;

		public static GameObject cruiserMapperPrefab;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Piggy.CruiserMap");
			PluginDirectory = ((BaseUnityPlugin)this).Info.Location;
			Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "cruisermap"));
			cruiserMapperPrefab = Bundle.LoadAsset<GameObject>("Navigation.prefab");
			mls.LogInfo((object)"CruiserMap is loaded!");
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(VehicleControllerPatch));
		}
	}
}
namespace CruiserMap.Patches
{
	public class VehicleMapper : MonoBehaviour
	{
		public VehicleController vehicle;

		public Transform cameraTarget;

		public Transform cruiserCameraTransform;

		private void Start()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(Plugin.cruiserMapperPrefab);
			val.transform.SetParent(((Component)vehicle).transform);
			val.transform.localPosition = Vector3.zero;
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = new Vector3(1f, 1f, 1f);
			cruiserCameraTransform = ((Component)val.transform.Find("CruiserNavCamera")).transform;
			cameraTarget = ((Component)val.transform.Find("CameraTarget")).transform;
			cruiserCameraTransform.SetParent((Transform)null);
		}

		private void Update()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			cruiserCameraTransform.position = Vector3.Lerp(cruiserCameraTransform.position, cameraTarget.position, Time.deltaTime * 5f);
			cruiserCameraTransform.rotation = Quaternion.Lerp(cruiserCameraTransform.rotation, cameraTarget.rotation, Time.deltaTime * 6f);
		}
	}
	[HarmonyPatch(typeof(VehicleController))]
	internal class VehicleControllerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Postfix(VehicleController __instance)
		{
			VehicleMapper vehicleMapper = ((Component)__instance).gameObject.AddComponent<VehicleMapper>();
			vehicleMapper.vehicle = __instance;
		}
	}
}