Decompiled source of MobilityPlus v1.7.0

MobilityPlus.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
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.Logging;
using EquinoxsModUtils;
using EquinoxsModUtils.Additions;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TechtonicaFramework.API;
using TechtonicaFramework.Equipment;
using TechtonicaFramework.TechTree;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("MobilityPlus")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f4f48ab92d73f99ec3f1c4f438c305a1fd13b4f9")]
[assembly: AssemblyProduct("MobilityPlus")]
[assembly: AssemblyTitle("MobilityPlus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 MobilityPlus
{
	[BepInPlugin("com.certifired.MobilityPlus", "MobilityPlus", "1.7.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MobilityPlusPlugin : BaseUnityPlugin
	{
		public const string MyGUID = "com.certifired.MobilityPlus";

		public const string PluginName = "MobilityPlus";

		public const string VersionString = "1.7.0";

		private static readonly Harmony Harmony = new Harmony("com.certifired.MobilityPlus");

		public static ManualLogSource Log;

		public static MobilityPlusPlugin Instance;

		public static ConfigEntry<bool> EnableEnhancedStilts;

		public static ConfigEntry<bool> EnableSpeedZones;

		public static ConfigEntry<bool> EnableJumpPads;

		public static ConfigEntry<float> StiltsMk2Height;

		public static ConfigEntry<float> StiltsMk3Height;

		public static ConfigEntry<float> SpeedBoostMultiplier;

		public static ConfigEntry<float> JumpPadForce;

		public static ConfigEntry<bool> DebugMode;

		public const string StiltsMk2Name = "Stilts MKII";

		public const string StiltsMk3Name = "Stilts MKIII";

		public const string SpeedBootsName = "Speed Boots";

		public const string JumpPackName = "Jump Pack";

		public const string GrappleMk2Name = "Rail Runner MKII";

		public const string AdvancedMobilityUnlock = "Advanced Mobility";

		public const string ExtremeSpeedUnlock = "Extreme Speed Tech";

		private static Dictionary<string, SpeedZoneData> speedZones = new Dictionary<string, SpeedZoneData>();

		public const string HoverPodName = "Hover Pod";

		public const string VehicleUnlock = "Personal Vehicle Tech";

		private static HoverPodController activeVehicle = null;

		public static ConfigEntry<bool> EnableVehicles;

		public static ConfigEntry<float> VehicleSpeed;

		public static ConfigEntry<float> VehicleHoverHeight;

		public static ConfigEntry<KeyCode> SummonVehicleKey;

		public static ConfigEntry<KeyCode> DismissVehicleKey;

		public static bool IsPlayerInVehicle => (Object)(object)activeVehicle != (Object)null && activeVehicle.IsPlayerMounted;

		private void Awake()
		{
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"MobilityPlus v1.7.0 loading...");
			InitializeConfig();
			Harmony.PatchAll();
			RegisterUnlocks();
			RegisterEnhancedStilts();
			RegisterSpeedEquipment();
			RegisterJumpPack();
			RegisterGrappleVariant();
			RegisterSpeedZonePlaceable();
			RegisterVehicle();
			Events.GameDefinesLoaded += OnGameDefinesLoaded;
			Events.GameLoaded += OnGameLoaded;
			Events.TechTreeStateLoaded += OnTechTreeStateLoaded;
			Log.LogInfo((object)"MobilityPlus v1.7.0 loaded!");
		}

		private void InitializeConfig()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Expected O, but got Unknown
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Expected O, but got Unknown
			EnableEnhancedStilts = ((BaseUnityPlugin)this).Config.Bind<bool>("Stilts", "Enable Enhanced Stilts", true, "Enable Stilts MKII and MKIII variants");
			StiltsMk2Height = ((BaseUnityPlugin)this).Config.Bind<float>("Stilts", "Stilts MKII Height", 4f, new ConfigDescription("Height increase for Stilts MKII", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 10f), Array.Empty<object>()));
			StiltsMk3Height = ((BaseUnityPlugin)this).Config.Bind<float>("Stilts", "Stilts MKIII Height", 6f, new ConfigDescription("Height increase for Stilts MKIII", (AcceptableValueBase)(object)new AcceptableValueRange<float>(3f, 15f), Array.Empty<object>()));
			EnableSpeedZones = ((BaseUnityPlugin)this).Config.Bind<bool>("Speed", "Enable Speed Zones", true, "Enable placeable speed boost zones");
			SpeedBoostMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Speed", "Speed Boost Multiplier", 1.5f, new ConfigDescription("Speed multiplier in speed zones", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.1f, 3f), Array.Empty<object>()));
			EnableJumpPads = ((BaseUnityPlugin)this).Config.Bind<bool>("Jump", "Enable Jump Pads", true, "Enable placeable jump pads");
			JumpPadForce = ((BaseUnityPlugin)this).Config.Bind<float>("Jump", "Jump Pad Force", 20f, new ConfigDescription("Upward force from jump pads", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 50f), Array.Empty<object>()));
			EnableVehicles = ((BaseUnityPlugin)this).Config.Bind<bool>("Vehicle", "Enable Vehicles", true, "Enable personal hover vehicle");
			VehicleSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Vehicle", "Vehicle Speed", 15f, new ConfigDescription("Base vehicle movement speed", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 30f), Array.Empty<object>()));
			VehicleHoverHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Vehicle", "Hover Height", 1.5f, new ConfigDescription("Height vehicle hovers above ground", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 5f), Array.Empty<object>()));
			SummonVehicleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Vehicle", "Summon Vehicle Key", (KeyCode)118, "Key to summon personal vehicle");
			DismissVehicleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Vehicle", "Dismiss Vehicle Key", (KeyCode)98, "Key to dismiss/exit vehicle");
			DebugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Debug Mode", false, "Enable debug logging");
		}

		private void RegisterUnlocks()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			EMUAdditions.AddNewUnlock(new NewUnlockDetails
			{
				category = ModdedTabModule.ModdedCategory,
				coreTypeNeeded = (CoreType)1,
				coreCountNeeded = 150,
				description = "Research enhanced mobility equipment including improved stilts and speed technology.",
				displayName = "Advanced Mobility",
				requiredTier = (ResearchTier)32,
				treePosition = 80
			}, false);
			EMUAdditions.AddNewUnlock(new NewUnlockDetails
			{
				category = ModdedTabModule.ModdedCategory,
				coreTypeNeeded = (CoreType)2,
				coreCountNeeded = 300,
				description = "Push the boundaries of movement with experimental speed and jump technology.",
				displayName = "Extreme Speed Tech",
				requiredTier = (ResearchTier)64,
				treePosition = 81,
				dependencyNames = new List<string> { "Advanced Mobility" }
			}, false);
			EMUAdditions.AddNewUnlock(new NewUnlockDetails
			{
				category = ModdedTabModule.ModdedCategory,
				coreTypeNeeded = (CoreType)2,
				coreCountNeeded = 500,
				description = "Research personal vehicle technology for faster long-distance travel.",
				displayName = "Personal Vehicle Tech",
				requiredTier = (ResearchTier)128,
				treePosition = 82
			}, false);
			Log.LogInfo((object)"Unlocks registered to Equipment category");
		}

		private void RegisterEnhancedStilts()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Expected O, but got Unknown
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Expected O, but got Unknown
			if (EnableEnhancedStilts.Value)
			{
				EMUAdditions.AddNewResource(new NewResourceDetails
				{
					name = "Stilts MKII",
					description = $"Enhanced stilts that extend to {StiltsMk2Height.Value}m height. Faster extension speed and more stable.",
					craftingMethod = (CraftingMethod)0,
					craftTierRequired = 0,
					headerTitle = "Modded",
					maxStackCount = 1,
					sortPriority = 200,
					unlockName = "Advanced Mobility",
					parentName = "Hover Pack"
				}, false);
				EMUAdditions.AddNewRecipe(new NewRecipeDetails
				{
					GUID = "com.certifired.MobilityPlus_stilts2",
					craftingMethod = (CraftingMethod)0,
					craftTierRequired = 0,
					duration = 15f,
					unlockName = "Advanced Mobility",
					ingredients = new List<RecipeResourceInfo>
					{
						new RecipeResourceInfo("Hover Pack", 1),
						new RecipeResourceInfo("Steel Frame", 5),
						new RecipeResourceInfo("Iron Components", 10)
					},
					outputs = new List<RecipeResourceInfo>
					{
						new RecipeResourceInfo("Stilts MKII", 1)
					},
					sortPriority = 200
				}, false);
				EMUAdditions.AddNewResource(new NewResourceDetails
				{
					name = "Stilts MKIII",
					description = $"Maximum height stilts extending to {StiltsMk3Height.Value}m. Includes gyroscopic stabilization for rough terrain.",
					craftingMethod = (CraftingMethod)0,
					craftTierRequired = 0,
					headerTitle = "Modded",
					maxStackCount = 1,
					sortPriority = 201,
					unlockName = "Extreme Speed Tech",
					parentName = "Hover Pack"
				}, false);
				EMUAdditions.AddNewRecipe(new NewRecipeDetails
				{
					GUID = "com.certifired.MobilityPlus_stilts3",
					craftingMethod = (CraftingMethod)0,
					craftTierRequired = 0,
					duration = 25f,
					unlockName = "Extreme Speed Tech",
					ingredients = new List<RecipeResourceInfo>
					{
						new RecipeResourceInfo("Hover Pack", 1),
						new RecipeResourceInfo("Processor Unit", 8),
						new RecipeResourceInfo("Electric Motor", 5),
						new RecipeResourceInfo("Steel Frame", 15)
					},
					outputs = new List<RecipeResourceInfo>
					{
						new RecipeResourceInfo("Stilts MKIII", 1)
					},
					sortPriority = 201
				}, false);
				LogDebug("Enhanced Stilts registered");
			}
		}

		private void RegisterSpeedEquipment()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			EMUAdditions.AddNewResource(new NewResourceDetails
			{
				name = "Speed Boots",
				description = "Motorized boots that increase base movement speed by 25%. Requires battery power.",
				craftingMethod = (CraftingMethod)0,
				craftTierRequired = 0,
				headerTitle = "Modded",
				maxStackCount = 1,
				sortPriority = 210,
				unlockName = "Advanced Mobility",
				parentName = "Iron Components"
			}, false);
			EMUAdditions.AddNewRecipe(new NewRecipeDetails
			{
				GUID = "com.certifired.MobilityPlus_speedboots",
				craftingMethod = (CraftingMethod)0,
				craftTierRequired = 0,
				duration = 20f,
				unlockName = "Advanced Mobility",
				ingredients = new List<RecipeResourceInfo>
				{
					new RecipeResourceInfo("Iron Frame", 5),
					new RecipeResourceInfo("Electric Motor", 2),
					new RecipeResourceInfo("Copper Wire", 15),
					new RecipeResourceInfo("Plantmatter Fiber", 10)
				},
				outputs = new List<RecipeResourceInfo>
				{
					new RecipeResourceInfo("Speed Boots", 1)
				},
				sortPriority = 210
			}, false);
			LogDebug("Speed equipment registered");
		}

		private void RegisterJumpPack()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			EMUAdditions.AddNewResource(new NewResourceDetails
			{
				name = "Jump Pack",
				description = "Compressed air-powered jump assist. Double-tap jump for a powerful boost. Limited charges, recharges over time.",
				craftingMethod = (CraftingMethod)0,
				craftTierRequired = 0,
				headerTitle = "Modded",
				maxStackCount = 1,
				sortPriority = 220,
				unlockName = "Extreme Speed Tech",
				parentName = "Iron Frame"
			}, false);
			EMUAdditions.AddNewRecipe(new NewRecipeDetails
			{
				GUID = "com.certifired.MobilityPlus_jumppack",
				craftingMethod = (CraftingMethod)0,
				craftTierRequired = 0,
				duration = 30f,
				unlockName = "Extreme Speed Tech",
				ingredients = new List<RecipeResourceInfo>
				{
					new RecipeResourceInfo("Steel Frame", 10),
					new RecipeResourceInfo("Mechanical Components", 5),
					new RecipeResourceInfo("Processor Unit", 2),
					new RecipeResourceInfo("Electric Motor", 2)
				},
				outputs = new List<RecipeResourceInfo>
				{
					new RecipeResourceInfo("Jump Pack", 1)
				},
				sortPriority = 220
			}, false);
			LogDebug("Jump Pack registered");
		}

		private void RegisterGrappleVariant()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			EMUAdditions.AddNewResource(new NewResourceDetails
			{
				name = "Rail Runner MKII",
				description = "Enhanced grappling hook with 50% longer range and faster retraction. Improved grip for heavy loads.",
				craftingMethod = (CraftingMethod)0,
				craftTierRequired = 0,
				headerTitle = "Modded",
				maxStackCount = 1,
				sortPriority = 230,
				unlockName = "Extreme Speed Tech",
				parentName = "Railrunner"
			}, false);
			EMUAdditions.AddNewRecipe(new NewRecipeDetails
			{
				GUID = "com.certifired.MobilityPlus_grapple2",
				craftingMethod = (CraftingMethod)0,
				craftTierRequired = 0,
				duration = 25f,
				unlockName = "Extreme Speed Tech",
				ingredients = new List<RecipeResourceInfo>
				{
					new RecipeResourceInfo("Railrunner", 1),
					new RecipeResourceInfo("Steel Frame", 5),
					new RecipeResourceInfo("Electric Motor", 3),
					new RecipeResourceInfo("Copper Wire", 20)
				},
				outputs = new List<RecipeResourceInfo>
				{
					new RecipeResourceInfo("Rail Runner MKII", 1)
				},
				sortPriority = 230
			}, false);
			LogDebug("Grapple variant registered");
		}

		private void RegisterSpeedZonePlaceable()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Expected O, but got Unknown
			if (EnableSpeedZones.Value)
			{
				EMUAdditions.AddNewResource(new NewResourceDetails
				{
					name = "Speed Pad",
					description = $"A placeable pad that boosts movement speed by {SpeedBoostMultiplier.Value}x when walked over. Perfect for factory floors.",
					craftingMethod = (CraftingMethod)0,
					craftTierRequired = 0,
					headerTitle = "Modded",
					maxStackCount = 20,
					sortPriority = 240,
					unlockName = "Advanced Mobility",
					parentName = "Conveyor Belt"
				}, false);
				EMUAdditions.AddNewRecipe(new NewRecipeDetails
				{
					GUID = "com.certifired.MobilityPlus_speedpad",
					craftingMethod = (CraftingMethod)0,
					craftTierRequired = 0,
					duration = 5f,
					unlockName = "Advanced Mobility",
					ingredients = new List<RecipeResourceInfo>
					{
						new RecipeResourceInfo("Iron Frame", 2),
						new RecipeResourceInfo("Electric Motor", 1),
						new RecipeResourceInfo("Copper Wire", 5)
					},
					outputs = new List<RecipeResourceInfo>
					{
						new RecipeResourceInfo("Speed Pad", 2)
					},
					sortPriority = 240
				}, false);
				if (EnableJumpPads.Value)
				{
					EMUAdditions.AddNewResource(new NewResourceDetails
					{
						name = "Jump Pad",
						description = "A placeable pad that launches the player upward when stepped on. Great for vertical navigation.",
						craftingMethod = (CraftingMethod)0,
						craftTierRequired = 0,
						headerTitle = "Modded",
						maxStackCount = 20,
						sortPriority = 241,
						unlockName = "Extreme Speed Tech",
						parentName = "Conveyor Belt"
					}, false);
					EMUAdditions.AddNewRecipe(new NewRecipeDetails
					{
						GUID = "com.certifired.MobilityPlus_jumppad",
						craftingMethod = (CraftingMethod)0,
						craftTierRequired = 0,
						duration = 8f,
						unlockName = "Extreme Speed Tech",
						ingredients = new List<RecipeResourceInfo>
						{
							new RecipeResourceInfo("Steel Frame", 3),
							new RecipeResourceInfo("Electric Motor", 2),
							new RecipeResourceInfo("Mechanical Components", 3)
						},
						outputs = new List<RecipeResourceInfo>
						{
							new RecipeResourceInfo("Jump Pad", 2)
						},
						sortPriority = 241
					}, false);
				}
				LogDebug("Speed/Jump pads registered");
			}
		}

		private void RegisterVehicle()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			if (EnableVehicles.Value)
			{
				EMUAdditions.AddNewResource(new NewResourceDetails
				{
					name = "Hover Pod",
					description = $"A personal hover vehicle for fast travel. Press V to summon, B to dismiss. Speed: {VehicleSpeed.Value}m/s.",
					craftingMethod = (CraftingMethod)0,
					craftTierRequired = 0,
					headerTitle = "Modded",
					maxStackCount = 1,
					sortPriority = 250,
					unlockName = "Personal Vehicle Tech",
					parentName = "Hover Pack"
				}, false);
				EMUAdditions.AddNewRecipe(new NewRecipeDetails
				{
					GUID = "com.certifired.MobilityPlus_hoverpod",
					craftingMethod = (CraftingMethod)0,
					craftTierRequired = 0,
					duration = 60f,
					unlockName = "Personal Vehicle Tech",
					ingredients = new List<RecipeResourceInfo>
					{
						new RecipeResourceInfo("Hover Pack", 2),
						new RecipeResourceInfo("Steel Frame", 20),
						new RecipeResourceInfo("Electric Motor", 5),
						new RecipeResourceInfo("Processor Unit", 5),
						new RecipeResourceInfo("Copper Wire", 30)
					},
					outputs = new List<RecipeResourceInfo>
					{
						new RecipeResourceInfo("Hover Pod", 1)
					},
					sortPriority = 250
				}, false);
				LogDebug("Vehicle registered");
			}
		}

		private void OnGameDefinesLoaded()
		{
			LinkUnlockToResource("Stilts MKII", "Advanced Mobility");
			LinkUnlockToResource("Stilts MKIII", "Extreme Speed Tech");
			LinkUnlockToResource("Speed Boots", "Advanced Mobility");
			LinkUnlockToResource("Jump Pack", "Extreme Speed Tech");
			LinkUnlockToResource("Rail Runner MKII", "Extreme Speed Tech");
			LinkUnlockToResource("Speed Pad", "Advanced Mobility");
			LinkUnlockToResource("Jump Pad", "Extreme Speed Tech");
			LinkUnlockToResource("Hover Pod", "Personal Vehicle Tech");
			Log.LogInfo((object)"Linked unlocks to resources");
		}

		private void LinkUnlockToResource(string resourceName, string unlockName)
		{
			try
			{
				ResourceInfo resourceInfoByName = Resources.GetResourceInfoByName(resourceName, false);
				if ((Object)(object)resourceInfoByName != (Object)null)
				{
					resourceInfoByName.unlock = Unlocks.GetUnlockByName(unlockName, false);
					LogDebug("Linked " + resourceName + " to unlock " + unlockName);
				}
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Failed to link " + resourceName + " to " + unlockName + ": " + ex.Message));
			}
		}

		private void OnGameLoaded()
		{
			RegisterEquipmentEffects();
		}

		private void OnTechTreeStateLoaded()
		{
			ConfigureUnlock("Advanced Mobility", "Hover Pack", (ResearchTier)64, 50);
			ConfigureUnlock("Extreme Speed Tech", "Hover Pack", (ResearchTier)512, 50);
			ConfigureUnlock("Personal Vehicle Tech", "Hover Pack", (ResearchTier)8192, 50);
			Log.LogInfo((object)"Configured MobilityPlus unlock tiers");
		}

		private void ConfigureUnlock(string unlockName, string spriteSourceName, ResearchTier tier, int position)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Unlock unlockByName = Unlocks.GetUnlockByName(unlockName, false);
				if ((Object)(object)unlockByName == (Object)null)
				{
					return;
				}
				unlockByName.requiredTier = tier;
				unlockByName.treePosition = position;
				if ((Object)(object)unlockByName.sprite == (Object)null)
				{
					ResourceInfo resourceInfoByName = Resources.GetResourceInfoByName(spriteSourceName, false);
					if ((Object)(object)resourceInfoByName != (Object)null && (Object)(object)resourceInfoByName.sprite != (Object)null)
					{
						unlockByName.sprite = resourceInfoByName.sprite;
					}
					else
					{
						Unlock unlockByName2 = Unlocks.GetUnlockByName(spriteSourceName, false);
						if ((Object)(object)unlockByName2 != (Object)null && (Object)(object)unlockByName2.sprite != (Object)null)
						{
							unlockByName.sprite = unlockByName2.sprite;
						}
					}
				}
				Log.LogInfo((object)$"Configured {unlockName}: tier={tier}, position={position}");
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Failed to configure unlock " + unlockName + ": " + ex.Message));
			}
		}

		private void RegisterEquipmentEffects()
		{
			try
			{
				FrameworkAPI.RegisterEquipment("speed_boots", "Speed Boots", "Motorized speed boots", (EquipmentSlot)3, (Action<Player>)delegate
				{
					try
					{
						FrameworkAPI.ApplyMovementModifier("speed_boots", 1.25f, 1f, -1f);
					}
					catch
					{
					}
					LogDebug("Speed Boots equipped - 25% speed boost active");
				}, (Action<Player>)delegate
				{
					try
					{
						FrameworkAPI.RemoveMovementModifier("speed_boots");
					}
					catch
					{
					}
					LogDebug("Speed Boots unequipped");
				}, (Action<Player>)null);
				FrameworkAPI.RegisterEquipment("jump_pack", "Jump Pack", "Compressed air jump assist", (EquipmentSlot)2, (Action<Player>)delegate
				{
					try
					{
						FrameworkAPI.ApplyMovementModifier("jump_pack", 1f, 1.5f, -1f);
					}
					catch
					{
					}
					LogDebug("Jump Pack equipped - 50% jump boost active");
				}, (Action<Player>)delegate
				{
					try
					{
						FrameworkAPI.RemoveMovementModifier("jump_pack");
					}
					catch
					{
					}
					LogDebug("Jump Pack unequipped");
				}, (Action<Player>)null);
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Failed to register equipment effects (TechtonicaFramework may not be ready): " + ex.Message));
			}
		}

		private void Update()
		{
			ProcessSpeedZones();
			if (EnableVehicles.Value)
			{
				HandleVehicleInput();
			}
		}

		private void HandleVehicleInput()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			Player instance = Player.instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			if (Input.GetKeyDown(SummonVehicleKey.Value))
			{
				if ((Object)(object)activeVehicle == (Object)null)
				{
					SummonVehicle(instance);
				}
				else if (!activeVehicle.IsPlayerMounted)
				{
					float num = Vector3.Distance(((Component)instance).transform.position, ((Component)activeVehicle).transform.position);
					if (num < 5f)
					{
						activeVehicle.Mount(instance);
					}
					else
					{
						activeVehicle.RecallToPlayer(instance);
					}
				}
			}
			if (Input.GetKeyDown(DismissVehicleKey.Value) && (Object)(object)activeVehicle != (Object)null)
			{
				if (activeVehicle.IsPlayerMounted)
				{
					activeVehicle.Dismount();
				}
				else
				{
					DismissVehicle();
				}
			}
		}

		private void SummonVehicle(Player player)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)player).transform.position + ((Component)player).transform.forward * 3f;
			position.y += VehicleHoverHeight.Value;
			GameObject val = CreateHoverPodVisual(position);
			activeVehicle = val.AddComponent<HoverPodController>();
			activeVehicle.speed = VehicleSpeed.Value;
			activeVehicle.hoverHeight = VehicleHoverHeight.Value;
			Log.LogInfo((object)"Hover Pod summoned! Press V near it to mount, B to dismiss.");
		}

		private void DismissVehicle()
		{
			if ((Object)(object)activeVehicle != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)activeVehicle).gameObject);
				activeVehicle = null;
				Log.LogInfo((object)"Hover Pod dismissed.");
			}
		}

		private GameObject CreateHoverPodVisual(Vector3 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("HoverPod");
			val.transform.position = position;
			Color color = default(Color);
			((Color)(ref color))..ctor(0.2f, 0.3f, 0.5f);
			Color color2 = default(Color);
			((Color)(ref color2))..ctor(0.4f, 0.7f, 0.9f);
			Color color3 = default(Color);
			((Color)(ref color3))..ctor(0.3f, 0.8f, 1f);
			GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)1);
			val2.transform.SetParent(val.transform);
			val2.transform.localPosition = Vector3.zero;
			val2.transform.localRotation = Quaternion.Euler(90f, 0f, 0f);
			val2.transform.localScale = new Vector3(1.5f, 2f, 1f);
			val2.GetComponent<Renderer>().material.color = color;
			Object.Destroy((Object)(object)val2.GetComponent<Collider>());
			GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0);
			val3.transform.SetParent(val.transform);
			val3.transform.localPosition = Vector3.up * 0.4f + Vector3.forward * 0.3f;
			val3.transform.localScale = new Vector3(0.8f, 0.5f, 0.8f);
			val3.GetComponent<Renderer>().material.color = new Color(0.5f, 0.8f, 1f, 0.5f);
			Object.Destroy((Object)(object)val3.GetComponent<Collider>());
			Vector3 localPosition = default(Vector3);
			for (int i = 0; i < 4; i++)
			{
				float num = (float)i / 4f * (float)Math.PI * 2f + (float)Math.PI / 4f;
				((Vector3)(ref localPosition))..ctor(Mathf.Cos(num) * 1.2f, -0.3f, Mathf.Sin(num) * 0.8f);
				GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)2);
				val4.transform.SetParent(val.transform);
				val4.transform.localPosition = localPosition;
				val4.transform.localScale = new Vector3(0.3f, 0.15f, 0.3f);
				val4.GetComponent<Renderer>().material.color = color2;
				Object.Destroy((Object)(object)val4.GetComponent<Collider>());
				GameObject val5 = GameObject.CreatePrimitive((PrimitiveType)0);
				val5.transform.SetParent(val4.transform);
				val5.transform.localPosition = Vector3.down * 0.5f;
				val5.transform.localScale = new Vector3(0.7f, 0.3f, 0.7f);
				val5.GetComponent<Renderer>().material.color = color3;
				Object.Destroy((Object)(object)val5.GetComponent<Collider>());
			}
			BoxCollider val6 = val.AddComponent<BoxCollider>();
			val6.size = new Vector3(3f, 1f, 2f);
			val6.center = Vector3.zero;
			Rigidbody val7 = val.AddComponent<Rigidbody>();
			val7.useGravity = false;
			val7.constraints = (RigidbodyConstraints)80;
			val7.drag = 3f;
			return val;
		}

		private void ProcessSpeedZones()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			Player instance = Player.instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			Vector3 position = ((Component)instance).transform.position;
			foreach (SpeedZoneData value in speedZones.Values)
			{
				float num = Vector3.Distance(position, value.Position);
				bool flag = num <= value.Radius;
				if (flag && !value.PlayerInside)
				{
					value.PlayerInside = true;
					try
					{
						FrameworkAPI.ApplyMovementModifier("speedzone_" + value.Id, value.SpeedMultiplier, 1f, -1f);
					}
					catch
					{
					}
					LogDebug("Entered speed zone " + value.Id);
				}
				else if (!flag && value.PlayerInside)
				{
					value.PlayerInside = false;
					try
					{
						FrameworkAPI.RemoveMovementModifier("speedzone_" + value.Id);
					}
					catch
					{
					}
					LogDebug("Exited speed zone " + value.Id);
				}
			}
		}

		public static void CreateSpeedZone(string id, Vector3 position, float radius, float multiplier)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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)
			speedZones[id] = new SpeedZoneData
			{
				Id = id,
				Position = position,
				Radius = radius,
				SpeedMultiplier = multiplier,
				PlayerInside = false
			};
			LogDebug($"Created speed zone {id} at {position}");
		}

		public static void RemoveSpeedZone(string id)
		{
			if (speedZones.TryGetValue(id, out var value))
			{
				if (value.PlayerInside)
				{
					FrameworkAPI.RemoveMovementModifier("speedzone_" + id);
				}
				speedZones.Remove(id);
			}
		}

		public static void LogDebug(string message)
		{
			if (DebugMode != null && DebugMode.Value)
			{
				Log.LogInfo((object)("[DEBUG] " + message));
			}
		}
	}
	public class SpeedZoneData
	{
		public string Id;

		public Vector3 Position;

		public float Radius;

		public float SpeedMultiplier;

		public bool PlayerInside;
	}
	public class HoverPodController : MonoBehaviour
	{
		public float speed = 15f;

		public float hoverHeight = 1.5f;

		public float hoverForce = 50f;

		public float rotationSpeed = 100f;

		public float tiltAmount = 15f;

		private Rigidbody rb;

		private Player mountedPlayer;

		private Vector3 originalPlayerPosition;

		private bool playerMounted = false;

		private float engineHum = 0f;

		private float bobOffset = 0f;

		public bool IsPlayerMounted => playerMounted;

		private void Start()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
			if ((Object)(object)rb == (Object)null)
			{
				rb = ((Component)this).gameObject.AddComponent<Rigidbody>();
				rb.useGravity = false;
				rb.drag = 3f;
				rb.constraints = (RigidbodyConstraints)80;
			}
		}

		private void Update()
		{
			bobOffset += Time.deltaTime * 2f;
			if (playerMounted && (Object)(object)mountedPlayer != (Object)null)
			{
				HandleMountedMovement();
				UpdatePlayerPosition();
			}
			else
			{
				ApplyIdleHover();
			}
		}

		private void FixedUpdate()
		{
			ApplyHoverPhysics();
		}

		private void ApplyHoverPhysics()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, hoverHeight * 3f))
			{
				float distance = ((RaycastHit)(ref val)).distance;
				float num = hoverHeight - distance;
				Vector3 val2 = Vector3.up * num * hoverForce;
				rb.AddForce(val2, (ForceMode)5);
			}
			else
			{
				rb.AddForce(Vector3.down * 5f, (ForceMode)5);
			}
			if (Mathf.Abs(rb.velocity.y) > 0.1f)
			{
				rb.velocity = new Vector3(rb.velocity.x, rb.velocity.y * 0.95f, rb.velocity.z);
			}
		}

		private void ApplyIdleHover()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Sin(bobOffset) * 0.05f;
			((Component)this).transform.position = new Vector3(((Component)this).transform.position.x, ((Component)this).transform.position.y + num * Time.deltaTime, ((Component)this).transform.position.z);
		}

		private void HandleMountedMovement()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			float axis = Input.GetAxis("Horizontal");
			float axis2 = Input.GetAxis("Vertical");
			Vector3 val = Vector3.zero;
			Vector3 val2;
			if ((Object)(object)Camera.main != (Object)null)
			{
				Vector3 forward = ((Component)Camera.main).transform.forward;
				Vector3 right = ((Component)Camera.main).transform.right;
				forward.y = 0f;
				right.y = 0f;
				((Vector3)(ref forward)).Normalize();
				((Vector3)(ref right)).Normalize();
				val2 = forward * axis2 + right * axis;
				val = ((Vector3)(ref val2)).normalized;
			}
			else
			{
				val2 = ((Component)this).transform.forward * axis2 + ((Component)this).transform.right * axis;
				val = ((Vector3)(ref val2)).normalized;
			}
			if (((Vector3)(ref val)).magnitude > 0.1f)
			{
				rb.AddForce(val * speed, (ForceMode)5);
				Quaternion val3 = Quaternion.LookRotation(val);
				((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val3, rotationSpeed * Time.deltaTime);
				val2 = rb.velocity;
				float magnitude = ((Vector3)(ref val2)).magnitude;
				float num = Mathf.Clamp(magnitude / speed, 0f, 1f) * tiltAmount;
				Transform transform = ((Component)this).transform;
				transform.localRotation *= Quaternion.Euler(num, 0f, 0f);
			}
			Vector3 val4 = default(Vector3);
			((Vector3)(ref val4))..ctor(rb.velocity.x, 0f, rb.velocity.z);
			if (((Vector3)(ref val4)).magnitude > speed)
			{
				val4 = ((Vector3)(ref val4)).normalized * speed;
				rb.velocity = new Vector3(val4.x, rb.velocity.y, val4.z);
			}
			if (Input.GetKey((KeyCode)32))
			{
				hoverHeight = Mathf.Min(hoverHeight + Time.deltaTime * 3f, 10f);
			}
			else if (Input.GetKey((KeyCode)306))
			{
				hoverHeight = Mathf.Max(hoverHeight - Time.deltaTime * 3f, 0.5f);
			}
			engineHum = Mathf.Lerp(engineHum, (((Vector3)(ref val)).magnitude > 0.1f) ? 1f : 0.3f, Time.deltaTime * 3f);
		}

		private void UpdatePlayerPosition()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)mountedPlayer != (Object)null)
			{
				Vector3 position = ((Component)this).transform.position + Vector3.up * 0.5f;
				((Component)mountedPlayer).transform.position = position;
			}
		}

		public void Mount(Player player)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			if (!playerMounted)
			{
				mountedPlayer = player;
				playerMounted = true;
				originalPlayerPosition = ((Component)player).transform.position;
				CharacterController component = ((Component)player).GetComponent<CharacterController>();
				if ((Object)(object)component != (Object)null)
				{
					((Collider)component).enabled = false;
				}
				((Component)player).transform.SetParent(((Component)this).transform);
				((Component)player).transform.localPosition = Vector3.up * 0.5f;
				MobilityPlusPlugin.Log.LogInfo((object)"Mounted Hover Pod! Use WASD to move, Space/Ctrl for altitude, B to dismount.");
			}
		}

		public void Dismount()
		{
			//IL_0039: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			if (playerMounted && !((Object)(object)mountedPlayer == (Object)null))
			{
				((Component)mountedPlayer).transform.SetParent((Transform)null);
				Vector3 val = ((Component)this).transform.position + ((Component)this).transform.right * 2f;
				RaycastHit val2 = default(RaycastHit);
				if (Physics.Raycast(val + Vector3.up * 5f, Vector3.down, ref val2, 20f))
				{
					val = ((RaycastHit)(ref val2)).point + Vector3.up * 0.1f;
				}
				((Component)mountedPlayer).transform.position = val;
				CharacterController component = ((Component)mountedPlayer).GetComponent<CharacterController>();
				if ((Object)(object)component != (Object)null)
				{
					((Collider)component).enabled = true;
				}
				mountedPlayer = null;
				playerMounted = false;
				MobilityPlusPlugin.Log.LogInfo((object)"Dismounted from Hover Pod.");
			}
		}

		public void RecallToPlayer(Player player)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (!playerMounted)
			{
				Vector3 position = ((Component)player).transform.position + ((Component)player).transform.forward * 3f;
				position.y = ((Component)player).transform.position.y + hoverHeight;
				((Component)this).transform.position = position;
				rb.velocity = Vector3.zero;
				MobilityPlusPlugin.Log.LogInfo((object)"Hover Pod recalled! Press V to mount.");
			}
		}

		private void OnDestroy()
		{
			if (playerMounted && (Object)(object)mountedPlayer != (Object)null)
			{
				Dismount();
			}
		}
	}
}