Decompiled source of HazardsOutside v1.2.4

plugins/LCHazardsOutside/LCHazardsOutside.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LCHazardsOutside.Abstract;
using LCHazardsOutside.Data;
using LCHazardsOutside.ModCompatibility;
using LCHazardsOutside.Patches;
using LCHazardsOutside.Strategy;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("LCHazardsOutside")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+03924a40eccc82ec032c9bceef2b554cb95c8401")]
[assembly: AssemblyProduct("LCHazardsOutside")]
[assembly: AssemblyTitle("LCHazardsOutside")]
[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 LCHazardsOutside
{
	public class LCUtils
	{
		public static readonly Dictionary<string, string[]> CUSTOM_LAYER_MASK = new Dictionary<string, string[]> { 
		{
			VanillaMoon.march.ToString(),
			new string[1] { "Room" }
		} };

		public static readonly Dictionary<string, HazardType> HAZARD_MAP = new Dictionary<string, HazardType>(3)
		{
			{
				"Landmine",
				HazardType.Landmine
			},
			{
				"TurretContainer",
				HazardType.Turret
			},
			{
				"SpikeRoofTrapHazard",
				HazardType.SpikeRoofTrap
			}
		};

		private static readonly Dictionary<SpawnStrategyType, SpawnStrategy> STRATEGY_MAP = new Dictionary<SpawnStrategyType, SpawnStrategy>(3)
		{
			{
				SpawnStrategyType.MainAndFireExit,
				MainAndFireExitSpawnStrategy.GetInstance()
			},
			{
				SpawnStrategyType.MainEntranceOnly,
				MainEntranceOnlySpawnStrategy.GetInstance()
			},
			{
				SpawnStrategyType.FireExitsOnly,
				FireExitsOnlySpawnStrategy.GetInstance()
			}
		};

		public static SpawnStrategy GetSpawnStrategy(string typeString)
		{
			try
			{
				SpawnStrategyType key = (SpawnStrategyType)Enum.Parse(typeof(SpawnStrategyType), typeString);
				if (STRATEGY_MAP.TryGetValue(key, out var value))
				{
					return value;
				}
			}
			catch (Exception)
			{
				Plugin.GetLogger().LogError((object)("Type " + typeString + " could not be parsed into a SpawnStrategyType. Reverting to default..."));
			}
			return MainAndFireExitSpawnStrategy.GetInstance();
		}

		public static string GetNumberlessMoonName(SelectableLevel selectableLevel)
		{
			if ((Object)(object)selectableLevel != (Object)null)
			{
				return new string(selectableLevel.PlanetName.SkipWhile((char c) => !char.IsLetter(c)).ToArray()).ToLower();
			}
			return string.Empty;
		}

		public static bool IsVanillaMoon(string moonName)
		{
			object result;
			return Enum.TryParse(typeof(VanillaMoon), moonName, ignoreCase: true, out result);
		}

		public static bool IsVanillaMoon(SelectableLevel selectableLevel)
		{
			object result;
			return Enum.TryParse(typeof(VanillaMoon), GetNumberlessMoonName(selectableLevel), ignoreCase: true, out result);
		}

		private static float RandomNumberInRadius(float radius, Random randomSeed)
		{
			return ((float)randomSeed.NextDouble() - 0.5f) * radius;
		}

		public static (Vector3, Quaternion) GetRandomGroundPositionAndRotation(Vector3 centerPoint, float radius = 10f, Random randomSeed = null, int layerMask = -1, int maxAttempts = 10)
		{
			//IL_0001: 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_010e: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0052: 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)
			//IL_006f: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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)
			float y = centerPoint.y;
			NavMeshHit val2 = default(NavMeshHit);
			RaycastHit val3 = default(RaycastHit);
			for (int i = 0; i < maxAttempts; i++)
			{
				try
				{
					float num = RandomNumberInRadius(radius, randomSeed);
					float num2 = RandomNumberInRadius(radius, randomSeed);
					float num3 = RandomNumberInRadius(radius, randomSeed);
					Vector3 val = centerPoint + new Vector3(num, num2, num3);
					val.y = y;
					float num4 = Vector3.Distance(centerPoint, val) + 30f;
					if (NavMesh.SamplePosition(val, ref val2, num4, -1))
					{
						if (Physics.Raycast(((NavMeshHit)(ref val2)).position + Vector3.up, Vector3.down, ref val3, 50f, layerMask))
						{
							return (((RaycastHit)(ref val3)).point + Vector3.up * 0.1f, Quaternion.FromToRotation(Vector3.up, ((RaycastHit)(ref val3)).normal));
						}
						Plugin.GetLogger().LogDebug((object)$"Nav hit at: {((NavMeshHit)(ref val2)).position} but ray cast failed.");
					}
				}
				catch (Exception)
				{
				}
			}
			return (Vector3.zero, Quaternion.identity);
		}

		public static void DetermineMinMaxSpawnRates(bool increasedMapHazardSpawnRate, int configMinSpawnRate, int configMaxSpawnRate, MoonMinMax moonMinMax, out int minSpawnRate, out int maxSpawnRate)
		{
			int num = moonMinMax?.Min ?? configMinSpawnRate;
			int num2 = moonMinMax?.Max ?? configMaxSpawnRate;
			minSpawnRate = Mathf.Min(Mathf.Max(num, 0), num2);
			maxSpawnRate = Mathf.Max(Mathf.Min(num2, 100), minSpawnRate);
			if (increasedMapHazardSpawnRate)
			{
				minSpawnRate = Mathf.Max(5, minSpawnRate);
				maxSpawnRate = Mathf.Min(maxSpawnRate * 2, 15);
			}
		}

		public static EntranceContainer FindAllExitPositions()
		{
			//IL_000e: 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_0075: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false);
			List<Vector3> list = new List<Vector3>();
			Vector3 mainEntrancePosition = Vector3.zero;
			for (int i = 0; i < array.Length; i++)
			{
				EntranceTeleport val = array[i];
				if (val.isEntranceToBuilding)
				{
					if (val.entranceId == 0)
					{
						mainEntrancePosition = ((Component)val).transform.position;
					}
					else
					{
						list.Add(((Component)array[i]).transform.position);
					}
				}
			}
			return new EntranceContainer(mainEntrancePosition, list);
		}

		public static Dictionary<string, MoonMinMax> ParseMoonString(string moonString)
		{
			if (string.IsNullOrEmpty(moonString))
			{
				return new Dictionary<string, MoonMinMax>();
			}
			Dictionary<string, MoonMinMax> dictionary = new Dictionary<string, MoonMinMax>();
			string[] array = moonString.Trim().ToLower().Split(',');
			string[] array2 = array;
			foreach (string text in array2)
			{
				try
				{
					string[] array3 = text.Trim().Split(':');
					dictionary.TryAdd(array3[0], new MoonMinMax(int.Parse(array3[1]), int.Parse(array3[2])));
				}
				catch (Exception)
				{
					Plugin.GetLogger().LogError((object)("There was an error while parsing the moon string " + text + ". Make sure it has the format moon:min:max."));
				}
			}
			return dictionary;
		}

		public static object GetReflectionField(object obj, string fieldName)
		{
			return AccessTools.Field(obj.GetType(), fieldName).GetValue(obj);
		}
	}
	[BepInPlugin("snake.tech.LCHazardsOutside", "LCHazardsOutside", "1.2.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "snake.tech.LCHazardsOutside";

		private const string modName = "LCHazardsOutside";

		private const string modVersion = "1.2.4";

		private readonly Harmony harmony = new Harmony("snake.tech.LCHazardsOutside");

		private readonly AcceptableValueRange<int> acceptableSpawnRange = new AcceptableValueRange<int>(0, 100);

		private readonly AcceptableValueList<string> acceptableSpawnStrategies = new AcceptableValueList<string>(Enum.GetNames(typeof(SpawnStrategyType)));

		public static Plugin instance;

		public bool IsCoroutineRunning = false;

		public HashSet<Type> hazardBlockList = new HashSet<Type>();

		public bool v49CompatibilityEnabled = false;

		public Dictionary<HazardType, HazardConfiguration> hazardConfigMap = new Dictionary<HazardType, HazardConfiguration>();

		public ConfigEntry<int> noHazardSpawnChance;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			LoadConfig();
			new LateGameUpgradesHandler().Apply();
			new V49Handler().Apply();
			harmony.PatchAll(typeof(RoundManagerPatch));
			GetLogger().LogInfo((object)"Plugin LCHazardsOutside is loaded!");
		}

		private void LoadConfig()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			ConfigDescription val = new ConfigDescription("This setting dictates how spawn positions are allocated. It has 3 possible options: \"MainAndFireExit\", \"MainEntranceOnly\" and \"FireExitsOnly\".\r\nWhen set to \"MainAndFireExit\", spawn positions are determined based on both the main entrance, the fire exits and the ship.\r\nWhen set to \"MainEntranceOnly\", spawn positions are limited strictly to the area between the ship and the main entrance of the facility, making spawn points more concentrated and fire exits safe.\r\nWhen set to \"FireExitsOnly\", spawn positions are limited strictly to the area between the ship and the fire exits of the facility, making fire exits more punishing while leaving the main entrance hassle-free.", (AcceptableValueBase)(object)acceptableSpawnStrategies, Array.Empty<object>());
			ConfigDescription val2 = new ConfigDescription("Minimum amount to spawn outside.", (AcceptableValueBase)(object)acceptableSpawnRange, Array.Empty<object>());
			ConfigDescription val3 = new ConfigDescription("Maximum amount to spawn outside.", (AcceptableValueBase)(object)acceptableSpawnRange, Array.Empty<object>());
			ConfigDescription val4 = new ConfigDescription("The moon(s) where this hazard can spawn outside in the form of a comma separated list of selectable level names with min/max values in moon:min:max format (e.g. \"experimentation:5:15,rend:0:10,dine:10:15\")\r\n\"NOTE: These must be the internal data names of the levels (for vanilla moons use the names you see on the terminal i.e. vow, march and for modded moons check their description or ask the author).", (AcceptableValueBase)null, Array.Empty<object>());
			noHazardSpawnChance = ((BaseUnityPlugin)this).Config.Bind<int>("0. General", "NoHazardSpawnChance", 0, "A global chance from 0 to 100 in % for NO hazards to spawn outside.\n Use a non-zero chance if you want to make hazards outside more of a surprise.");
			ConfigEntry<bool> val5 = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Landmine", "EnableLandmineOutside", true, "Whether or not to spawn landmines outside.");
			ConfigEntry<int> val6 = ((BaseUnityPlugin)this).Config.Bind<int>("1. Landmine", "LandmineMinSpawnRate", 15, val2);
			ConfigEntry<int> val7 = ((BaseUnityPlugin)this).Config.Bind<int>("1. Landmine", "LandmineMaxSpawnRate", 30, val3);
			ConfigEntry<string> val8 = ((BaseUnityPlugin)this).Config.Bind<string>("1. Landmine", "LandmineMoons", "", val4);
			ConfigEntry<string> val9 = ((BaseUnityPlugin)this).Config.Bind<string>("1. Landmine", "LandmineSpawnStrategy", SpawnStrategyType.MainAndFireExit.ToString(), val);
			Dictionary<string, MoonMinMax> moonMap = LCUtils.ParseMoonString(val8.Value);
			SpawnStrategy spawnStrategy = LCUtils.GetSpawnStrategy(val9.Value);
			hazardConfigMap.Add(HazardType.Landmine, new HazardConfiguration(val5.Value, val6.Value, val7.Value, moonMap, spawnStrategy));
			ConfigEntry<bool> val10 = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Turret", "EnableTurretOutside", false, "Whether or not to spawn turrets outside.");
			ConfigEntry<int> val11 = ((BaseUnityPlugin)this).Config.Bind<int>("2. Turret", "TurretMinSpawnRate", 0, val2);
			ConfigEntry<int> val12 = ((BaseUnityPlugin)this).Config.Bind<int>("2. Turret", "TurretMaxSpawnRate", 1, val3);
			ConfigEntry<string> val13 = ((BaseUnityPlugin)this).Config.Bind<string>("2. Turret", "TurretMoons", "", val4);
			ConfigEntry<string> val14 = ((BaseUnityPlugin)this).Config.Bind<string>("2. Turret", "TurretSpawnStrategy", SpawnStrategyType.MainAndFireExit.ToString(), val);
			Dictionary<string, MoonMinMax> moonMap2 = LCUtils.ParseMoonString(val13.Value);
			SpawnStrategy spawnStrategy2 = LCUtils.GetSpawnStrategy(val14.Value);
			hazardConfigMap.Add(HazardType.Turret, new HazardConfiguration(val10.Value, val11.Value, val12.Value, moonMap2, spawnStrategy2));
			ConfigEntry<bool> val15 = ((BaseUnityPlugin)this).Config.Bind<bool>("3. SpikeRoofTrap", "EnableSpikeRoofTrapOutside", true, "Whether or not to spawn spike roof traps outside.");
			ConfigEntry<int> val16 = ((BaseUnityPlugin)this).Config.Bind<int>("3. SpikeRoofTrap", "SpikeRoofTrapMinSpawnRate", 0, val2);
			ConfigEntry<int> val17 = ((BaseUnityPlugin)this).Config.Bind<int>("3. SpikeRoofTrap", "SpikeRoofTrapMaxSpawnRate", 2, val3);
			ConfigEntry<string> val18 = ((BaseUnityPlugin)this).Config.Bind<string>("3. SpikeRoofTrap", "SpikeRoofTrapMoons", "", val4);
			ConfigEntry<string> val19 = ((BaseUnityPlugin)this).Config.Bind<string>("3. SpikeRoofTrap", "SpikeRoofTrapSpawnStrategy", SpawnStrategyType.MainAndFireExit.ToString(), val);
			Dictionary<string, MoonMinMax> moonMap3 = LCUtils.ParseMoonString(val18.Value);
			SpawnStrategy spawnStrategy3 = LCUtils.GetSpawnStrategy(val19.Value);
			hazardConfigMap.Add(HazardType.SpikeRoofTrap, new HazardConfiguration(val15.Value, val16.Value, val17.Value, moonMap3, spawnStrategy3));
			ConfigEntry<bool> val20 = ((BaseUnityPlugin)this).Config.Bind<bool>("99. Custom", "EnableCustomHazardOutside", false, "Whether or not to spawn modded hazards outside.");
			ConfigEntry<int> val21 = ((BaseUnityPlugin)this).Config.Bind<int>("99. Custom", "CustomHazardMinSpawnRate", 0, val2);
			ConfigEntry<int> val22 = ((BaseUnityPlugin)this).Config.Bind<int>("99. Custom", "CustomHazardMaxSpawnRate", 3, val3);
			ConfigEntry<string> val23 = ((BaseUnityPlugin)this).Config.Bind<string>("99. Custom", "CustomHazardMoons", "", val4);
			ConfigEntry<string> val24 = ((BaseUnityPlugin)this).Config.Bind<string>("99. Custom", "CustomHazardSpawnStrategy", SpawnStrategyType.MainAndFireExit.ToString(), val);
			Dictionary<string, MoonMinMax> moonMap4 = LCUtils.ParseMoonString(val23.Value);
			SpawnStrategy spawnStrategy4 = LCUtils.GetSpawnStrategy(val24.Value);
			hazardConfigMap.Add(HazardType.CustomHazard, new HazardConfiguration(val20.Value, val21.Value, val22.Value, moonMap4, spawnStrategy4));
		}

		public static ManualLogSource GetLogger()
		{
			return ((BaseUnityPlugin)instance).Logger;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LCHazardsOutside";

		public const string PLUGIN_NAME = "LCHazardsOutside";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LCHazardsOutside.Strategy
{
	internal class FireExitsOnlySpawnStrategy : SpawnStrategy
	{
		private static FireExitsOnlySpawnStrategy instance;

		private FireExitsOnlySpawnStrategy()
		{
		}

		public static FireExitsOnlySpawnStrategy GetInstance()
		{
			if (instance == null)
			{
				instance = new FireExitsOnlySpawnStrategy();
			}
			return instance;
		}

		public override List<SpawnPositionData> CalculateCenterPositions(Vector3 shipLandPosition, Vector3 mainEntrancePosition, List<Vector3> pointsOfInterest, float spawnRadiusMultiplier)
		{
			//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_001c: 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)
			List<SpawnPositionData> list = new List<SpawnPositionData>();
			foreach (Vector3 item in pointsOfInterest)
			{
				list.Add(CalculateCenterWithSpawnRadius(shipLandPosition, item, spawnRadiusMultiplier));
			}
			return list;
		}
	}
	internal class MainAndFireExitSpawnStrategy : SpawnStrategy
	{
		private static MainAndFireExitSpawnStrategy instance;

		private MainAndFireExitSpawnStrategy()
		{
		}

		public static MainAndFireExitSpawnStrategy GetInstance()
		{
			if (instance == null)
			{
				instance = new MainAndFireExitSpawnStrategy();
			}
			return instance;
		}

		public override List<SpawnPositionData> CalculateCenterPositions(Vector3 shipLandPosition, Vector3 mainEntrancePosition, List<Vector3> pointsOfInterest, float spawnRadiusMultiplier)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_002e: 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)
			List<SpawnPositionData> list = new List<SpawnPositionData>(1) { CalculateCenterWithSpawnRadius(shipLandPosition, mainEntrancePosition, spawnRadiusMultiplier) };
			foreach (Vector3 item in pointsOfInterest)
			{
				list.Add(CalculateCenterWithSpawnRadius(shipLandPosition, item, spawnRadiusMultiplier));
			}
			return list;
		}
	}
	internal class MainEntranceOnlySpawnStrategy : SpawnStrategy
	{
		private static MainEntranceOnlySpawnStrategy instance;

		private MainEntranceOnlySpawnStrategy()
		{
		}

		public static MainEntranceOnlySpawnStrategy GetInstance()
		{
			if (instance == null)
			{
				instance = new MainEntranceOnlySpawnStrategy();
			}
			return instance;
		}

		public override List<SpawnPositionData> CalculateCenterPositions(Vector3 shipLandPosition, Vector3 mainEntrancePosition, List<Vector3> pointsOfInterest, float spawnRadiusMultiplier)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			SpawnPositionData item = CalculateCenterWithSpawnRadius(shipLandPosition, mainEntrancePosition, spawnRadiusMultiplier);
			return new List<SpawnPositionData>(1) { item };
		}
	}
}
namespace LCHazardsOutside.Patches
{
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatch
	{
		private const string HAZARD_LAYER_NAME = "MapHazards";

		[HarmonyPatch("SpawnOutsideHazards")]
		[HarmonyPrefix]
		private static void SpawnHazardsOutsidePatch(RoundManager __instance)
		{
			if (!__instance.currentLevel.spawnEnemiesAndScrap || !((NetworkBehaviour)__instance).IsServer || !((NetworkBehaviour)__instance).IsHost)
			{
				return;
			}
			Plugin.GetLogger().LogDebug((object)("randomMapSeed: " + StartOfRound.Instance.randomMapSeed));
			Random random = new Random(StartOfRound.Instance.randomMapSeed + 587);
			int value = Plugin.instance.noHazardSpawnChance.Value;
			if (value > 0)
			{
				double num = (double)value / 100.0;
				if (random.NextDouble() < num)
				{
					Plugin.GetLogger().LogInfo((object)"No hazards spawned outside due to global chance.");
					return;
				}
			}
			SpawnableMapObject[] spawnableMapObjects = __instance.currentLevel.spawnableMapObjects;
			if (spawnableMapObjects.Length != 0)
			{
				((MonoBehaviour)__instance).StartCoroutine(SpawnHazardsAfterExitSpawn(__instance, spawnableMapObjects, random));
			}
		}

		private static void SpawnHazardsOutside(RoundManager __instance, SpawnableMapObject[] hazardObjects, EntranceContainer entranceContainer, Random random)
		{
			string numberlessMoonName = LCUtils.GetNumberlessMoonName(__instance.currentLevel);
			Plugin.GetLogger().LogDebug((object)("Planetname: " + numberlessMoonName));
			LCUtils.CUSTOM_LAYER_MASK.TryGetValue(numberlessMoonName, out var value);
			if (value == null)
			{
				value = new string[2] { "Room", "Default" };
			}
			int mask = LayerMask.GetMask(value);
			GameObject[] array = GameObject.FindGameObjectsWithTag("SpawnDenialPoint");
			List<GameObject> list = new List<GameObject>(array.Length);
			list.AddRange(array);
			List<GameObject> spawnDenialPoints = list;
			var array2 = hazardObjects.Select((SpawnableMapObject hazardObject, int index) => new
			{
				HazardObject = hazardObject,
				IsBlacklisted = Plugin.instance.hazardBlockList.Any((Type type) => (Object)(object)hazardObject.prefabToSpawn.GetComponent(type) != (Object)null),
				IsIncreasedSpawnRate = (__instance.increasedMapHazardSpawnRateIndex == index)
			}).ToArray();
			var array3 = array2;
			foreach (var anon in array3)
			{
				Plugin.GetLogger().LogDebug((object)("Current spawnable object: " + ((Object)anon.HazardObject.prefabToSpawn).name));
				if (anon.IsBlacklisted)
				{
					Plugin.GetLogger().LogInfo((object)("Hazard blocked from spawning due to blacklist: " + ((Object)anon.HazardObject.prefabToSpawn).name));
					continue;
				}
				HazardType type2 = HazardType.CustomHazard;
				if (LCUtils.HAZARD_MAP.TryGetValue(((Object)anon.HazardObject.prefabToSpawn).name, out var value2))
				{
					type2 = value2;
				}
				ProcessHazard(type2, __instance, anon.IsIncreasedSpawnRate, anon.HazardObject, spawnDenialPoints, numberlessMoonName, entranceContainer, random, mask);
			}
			Plugin.GetLogger().LogInfo((object)"Outside hazard spawning done.");
		}

		private static void ProcessHazard(HazardType type, RoundManager __instance, bool isIncreasedSpawnRate, SpawnableMapObject hazardObj, List<GameObject> spawnDenialPoints, string moonName, EntranceContainer entranceContainer, Random random, int layerMask)
		{
			Plugin.instance.hazardConfigMap.TryGetValue(type, out var value);
			if (value.Enabled)
			{
				Plugin.GetLogger().LogInfo((object)$"Spawning {type}s outside...");
				value.MoonMap.TryGetValue(moonName, out var value2);
				LCUtils.DetermineMinMaxSpawnRates(isIncreasedSpawnRate, value.MinSpawnRate, value.MaxSpawnRate, value2, out var minSpawnRate, out var maxSpawnRate);
				HazardCalculationContainer hazardCalculationContainer = new HazardCalculationContainer(random, spawnDenialPoints, hazardObj, minSpawnRate, maxSpawnRate, layerMask);
				if (type == HazardType.Turret)
				{
					hazardCalculationContainer.NeedsSafetyZone = true;
					hazardCalculationContainer.SpawnRatioMultiplier = 1.25f;
				}
				if (type == HazardType.SpikeRoofTrap)
				{
					hazardCalculationContainer.NeedsSafetyZone = true;
				}
				CalculateHazardSpawn(__instance, hazardCalculationContainer, entranceContainer, value.SpawnStrategy);
			}
		}

		private static void CalculateHazardSpawn(RoundManager __instance, HazardCalculationContainer hazardCalculationContainer, EntranceContainer entranceContainer, SpawnStrategy spawnStrategy)
		{
			//IL_0002: 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_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_005d: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_00f1: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			Vector3 mainEntrancePosition = entranceContainer.MainEntrancePosition;
			List<Vector3> fireExitPositions = entranceContainer.FireExitPositions;
			Transform[] shipSpawnPathPoints = __instance.shipSpawnPathPoints;
			int num = 0;
			Vector3 position = shipSpawnPathPoints.Last().position;
			int num2 = hazardCalculationContainer.Random.Next(hazardCalculationContainer.MinSpawnRate, hazardCalculationContainer.MaxSpawnRate + 1);
			Plugin.GetLogger().LogDebug((object)("Random spawn rate: " + num2));
			List<SpawnPositionData> list = spawnStrategy.CalculateCenterPositions(position, mainEntrancePosition, fireExitPositions, hazardCalculationContainer.SpawnRatioMultiplier);
			List<GameObject> list2 = new List<GameObject>();
			int layerMask = hazardCalculationContainer.LayerMask;
			int num3 = num2 / list.Count;
			Plugin.GetLogger().LogDebug((object)("Actual spawn rate per position: " + num3));
			foreach (SpawnPositionData item in list)
			{
				for (int i = 0; i < num3; i++)
				{
					var (val, quaternion) = LCUtils.GetRandomGroundPositionAndRotation(item.CenterPosition, item.SpawnRadius, hazardCalculationContainer.Random, layerMask);
					if (val == Vector3.zero)
					{
						Plugin.GetLogger().LogDebug((object)"No NavMesh hit!");
						continue;
					}
					List<Vector3> list3 = new List<Vector3>(1) { position };
					list3.AddRange(hazardCalculationContainer.SpawnDenialPoints.Select((GameObject x) => x.transform.position).ToArray());
					GameObject val2 = GameObject.Find("PlayerShipNavmesh");
					if ((Object)(object)val2 != (Object)null)
					{
						Vector3 position2 = val2.transform.position;
						list3.Add(position2);
					}
					if (IsInvalidSpawnPoint(list3, val, hazardCalculationContainer.NeedsSafetyZone ? 18f : 8f))
					{
						ManualLogSource logger = Plugin.GetLogger();
						Vector3 val3 = val;
						logger.LogDebug((object)("Hazard was too close to denial or safety zone and was therefore deleted: " + ((object)(Vector3)(ref val3)).ToString()));
					}
					else
					{
						list2.Add(InstantiateHazardObject(__instance, hazardCalculationContainer.SpawnableMapObject, val, quaternion));
						num++;
					}
				}
			}
			((MonoBehaviour)__instance).StartCoroutine(SpawnHazardsInBulk(list2));
			Plugin.GetLogger().LogDebug((object)("Total hazard amount: " + num));
		}

		private static GameObject InstantiateHazardObject(RoundManager __instance, SpawnableMapObject spawnableMapObject, Vector3 position, Quaternion quaternion)
		{
			//IL_000b: 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_002b: 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_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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_00bf: 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_00ce: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: 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_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource logger = Plugin.GetLogger();
			Vector3 val = position;
			logger.LogDebug((object)("Spawn hazard outside at: " + ((object)(Vector3)(ref val)).ToString()));
			GameObject val2 = Object.Instantiate<GameObject>(spawnableMapObject.prefabToSpawn, position, quaternion, __instance.mapPropsContainer.transform);
			if (spawnableMapObject.spawnFacingAwayFromWall)
			{
				val2.transform.eulerAngles = new Vector3(0f, __instance.YRotationThatFacesTheFarthestFromPosition(position + Vector3.up * 0.2f, 25f, 6), 0f);
			}
			if (!Plugin.instance.v49CompatibilityEnabled)
			{
				if ((bool)LCUtils.GetReflectionField(spawnableMapObject, "spawnFacingWall"))
				{
					val2.transform.eulerAngles = new Vector3(0f, __instance.YRotationThatFacesTheNearestFromPosition(position + Vector3.up * 0.2f, 25f, 6), 0f);
				}
				RaycastHit val3 = default(RaycastHit);
				if ((bool)LCUtils.GetReflectionField(spawnableMapObject, "spawnWithBackToWall") && Physics.Raycast(val2.transform.position, -val2.transform.forward, ref val3, 300f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
				{
					RaycastHit val4 = default(RaycastHit);
					if (Physics.Raycast(((RaycastHit)(ref val3)).point + Vector3.up * 0.2f, Vector3.down, ref val4, 50f, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
					{
						val2.transform.position = ((RaycastHit)(ref val4)).point;
					}
					else
					{
						val2.transform.position = ((RaycastHit)(ref val3)).point;
					}
					if ((bool)LCUtils.GetReflectionField(spawnableMapObject, "spawnWithBackFlushAgainstWall"))
					{
						val2.transform.forward = -((RaycastHit)(ref val3)).normal;
						val2.transform.eulerAngles = new Vector3(0f, val2.transform.eulerAngles.y, 0f);
					}
				}
			}
			val2.SetActive(true);
			val2.layer = LayerMask.NameToLayer("MapHazards");
			return val2;
		}

		private static bool IsInvalidSpawnPoint(List<Vector3> spawnDenialPoints, Vector3 randomPosition, float safetyDistance)
		{
			//IL_000d: 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_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)
			foreach (Vector3 spawnDenialPoint in spawnDenialPoints)
			{
				if (Vector3.Distance(randomPosition, spawnDenialPoint) < safetyDistance)
				{
					return true;
				}
			}
			return false;
		}

		public static IEnumerator SpawnHazardsInBulk(List<GameObject> gameObjects)
		{
			yield return (object)new WaitWhile((Func<bool>)(() => Plugin.instance.IsCoroutineRunning));
			Plugin.instance.IsCoroutineRunning = true;
			Plugin.GetLogger().LogDebug((object)"SpawnHazardsInBulk Coroutine running.");
			for (int i = 0; i < gameObjects.Count; i += 10)
			{
				int range = Mathf.Min(10, gameObjects.Count - i);
				for (int j = 0; j < range; j++)
				{
					GameObject objectToSpawn = gameObjects[i + j];
					try
					{
						if ((Object)(object)objectToSpawn != (Object)null)
						{
							NetworkObject networkObject = objectToSpawn.GetComponent<NetworkObject>();
							if ((Object)(object)networkObject != (Object)null)
							{
								networkObject.Spawn(true);
							}
							else
							{
								Plugin.GetLogger().LogError((object)("Hazard " + ((Object)objectToSpawn).name + " had no network object and cannot be spawned."));
							}
						}
						else
						{
							Plugin.GetLogger().LogError((object)"Hazard object was destroyed before it could spawn. Probably needs compatibility patch.");
						}
					}
					catch (Exception e)
					{
						Plugin.GetLogger().LogError((object)$"NetworkObject {((Object)objectToSpawn).name} could not be spawned: {e}");
					}
				}
				yield return (object)new WaitForSeconds(0.5f);
			}
			Plugin.instance.IsCoroutineRunning = false;
			Plugin.GetLogger().LogDebug((object)"SpawnHazardsInBulk Coroutine done.");
		}

		public static IEnumerator SpawnHazardsAfterExitSpawn(RoundManager __instance, SpawnableMapObject[] hazardObjects, Random random)
		{
			float startTime = Time.timeSinceLevelLoad;
			EntranceContainer entranceContainer = LCUtils.FindAllExitPositions();
			Plugin.GetLogger().LogDebug((object)$"Time since level loaded: {startTime}");
			while (!entranceContainer.IsInitialized() && Time.timeSinceLevelLoad - startTime < 15f)
			{
				Plugin.GetLogger().LogDebug((object)"Waiting for main entrance to load...");
				yield return (object)new WaitForSeconds(1f);
				entranceContainer = LCUtils.FindAllExitPositions();
			}
			SpawnHazardsOutside(__instance, hazardObjects, entranceContainer, random);
		}
	}
}
namespace LCHazardsOutside.ModCompatibility
{
	internal class LateGameUpgradesHandler : AbstractCompatibilityHandler
	{
		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		protected override void DoApply()
		{
			LogApply();
			Assembly targetAssembly = GetTargetAssembly("MoreShipUpgrades");
			if (targetAssembly == null)
			{
				Plugin.GetLogger().LogError((object)"Target assembly 'MoreShipUpgrades' not found.");
				return;
			}
			AddTypeToHazardBlockList(targetAssembly, "MoreShipUpgrades.UpgradeComponents.Items.Wheelbarrow.ScrapWheelbarrow");
			AddContractItemsToBlocklist(targetAssembly);
		}

		private void AddTypeToHazardBlockList(Assembly assembly, string typeName)
		{
			Type type = assembly.GetTypes().FirstOrDefault((Type t) => t.FullName == typeName);
			if (type != null)
			{
				Plugin.instance.hazardBlockList.Add(type);
				Plugin.GetLogger().LogDebug((object)("Added " + typeName + " to hazardBlockList."));
			}
			else
			{
				Plugin.GetLogger().LogWarning((object)("Type " + typeName + " not found in assembly."));
			}
		}

		private void AddContractItemsToBlocklist(Assembly assembly)
		{
			Type baseType = assembly.GetTypes().FirstOrDefault((Type t) => t.Name == "ContractObject");
			if (baseType == null)
			{
				Plugin.GetLogger().LogError((object)"Base type ContractObject not found in assembly.");
				return;
			}
			IEnumerable<Type> enumerable = from t in assembly.GetTypes()
				where t.IsClass && !t.IsAbstract && t.IsSubclassOf(baseType)
				select t;
			foreach (Type item in enumerable)
			{
				Plugin.instance.hazardBlockList.Add(item);
				Plugin.GetLogger().LogDebug((object)("Added " + item.Name + " to hazardBlockList."));
			}
		}

		protected override string GetModGUID()
		{
			return "com.malco.lethalcompany.moreshipupgrades";
		}
	}
	internal class V49Handler : AbstractCompatibilityHandler
	{
		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		protected override void DoApply()
		{
			Assembly targetAssembly = GetTargetAssembly("Assembly-CSharp");
			if (targetAssembly == null)
			{
				Plugin.GetLogger().LogError((object)"Target assembly 'Assembly-CSharp' not found.");
				return;
			}
			Plugin.instance.v49CompatibilityEnabled = !targetAssembly.GetTypes().Any((Type type) => type.Name.Equals("SpikeRoofTrap", StringComparison.OrdinalIgnoreCase));
			if (Plugin.instance.v49CompatibilityEnabled)
			{
				Plugin.GetLogger().LogInfo((object)"Running in v49 compatibility mode.");
			}
		}

		protected override string GetModGUID()
		{
			return "snake.tech.LCHazardsOutside";
		}
	}
}
namespace LCHazardsOutside.Data
{
	public class EntranceContainer
	{
		public Vector3 MainEntrancePosition { get; set; }

		public List<Vector3> FireExitPositions { get; set; }

		public EntranceContainer(Vector3 mainEntrancePosition, List<Vector3> fireExitPositions)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			MainEntrancePosition = mainEntrancePosition;
			FireExitPositions = fireExitPositions;
			base..ctor();
		}

		public bool IsInitialized()
		{
			//IL_0002: 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)
			return MainEntrancePosition != Vector3.zero && FireExitPositions.All((Vector3 x) => x != Vector3.zero);
		}
	}
	internal class HazardCalculationContainer
	{
		public Random Random { get; set; }

		public List<GameObject> SpawnDenialPoints { get; set; }

		public SpawnableMapObject SpawnableMapObject { get; set; }

		public int MinSpawnRate { get; set; }

		public int MaxSpawnRate { get; set; }

		public bool NeedsSafetyZone { get; set; }

		public float SpawnRatioMultiplier { get; set; }

		public int LayerMask { get; set; }

		public HazardCalculationContainer(Random random, List<GameObject> spawnDenialPoints, SpawnableMapObject spawnableMapObject, int minSpawnRate, int maxSpawnRate, int layerMask)
		{
			Random = random;
			SpawnDenialPoints = spawnDenialPoints;
			SpawnableMapObject = spawnableMapObject;
			MinSpawnRate = minSpawnRate;
			MaxSpawnRate = maxSpawnRate;
			NeedsSafetyZone = false;
			SpawnRatioMultiplier = 1.5f;
			LayerMask = layerMask;
			base..ctor();
		}
	}
	public class HazardConfiguration
	{
		public bool Enabled { get; set; }

		public int MinSpawnRate { get; set; }

		public int MaxSpawnRate { get; set; }

		public Dictionary<string, MoonMinMax> MoonMap { get; set; }

		public SpawnStrategy SpawnStrategy { get; set; }

		public HazardConfiguration(bool enabled, int minSpawnRate, int maxSpawnRate, Dictionary<string, MoonMinMax> moonMap, SpawnStrategy spawnStrategy)
		{
			Enabled = enabled;
			MinSpawnRate = minSpawnRate;
			MaxSpawnRate = maxSpawnRate;
			MoonMap = moonMap;
			SpawnStrategy = spawnStrategy;
			base..ctor();
		}
	}
	public enum HazardType
	{
		Landmine,
		Turret,
		SpikeRoofTrap,
		CustomHazard
	}
	public class MoonMinMax
	{
		public int Min { get; set; }

		public int Max { get; set; }

		public MoonMinMax(int min, int max)
		{
			Min = min;
			Max = max;
			base..ctor();
		}
	}
	public record struct SpawnPositionData
	{
		public Vector3 CenterPosition { get; set; }

		public float SpawnRadius { get; set; }

		public SpawnPositionData(Vector3 centerPosition, float spawnRadius)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			this = default(SpawnPositionData);
			CenterPosition = centerPosition;
			SpawnRadius = spawnRadius;
		}

		[CompilerGenerated]
		private readonly bool PrintMembers(StringBuilder builder)
		{
			//IL_000e: 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)
			builder.Append("CenterPosition = ");
			Vector3 centerPosition = CenterPosition;
			builder.Append(((object)(Vector3)(ref centerPosition)).ToString());
			builder.Append(", SpawnRadius = ");
			builder.Append(SpawnRadius.ToString());
			return true;
		}
	}
	public enum SpawnStrategyType
	{
		MainAndFireExit,
		MainEntranceOnly,
		FireExitsOnly
	}
	internal enum VanillaMoon
	{
		experimentation,
		assurance,
		offense,
		vow,
		march,
		rend,
		dine,
		titan,
		adamance,
		embrion,
		artifice,
		liquidation
	}
}
namespace LCHazardsOutside.Abstract
{
	internal abstract class AbstractCompatibilityHandler
	{
		protected abstract void DoApply();

		protected abstract string GetModGUID();

		private bool IsEnabled()
		{
			return Chainloader.PluginInfos.ContainsKey(GetModGUID());
		}

		public void Apply()
		{
			if (IsEnabled())
			{
				try
				{
					DoApply();
				}
				catch (Exception arg)
				{
					Plugin.GetLogger().LogError((object)$"There was an error in patching {GetModGUID()}. Skipping... \n {arg}\n");
				}
			}
		}

		protected void LogApply()
		{
			Plugin.GetLogger().LogInfo((object)("Applying compatibility fixes for " + GetModGUID() + "."));
		}

		protected Assembly GetTargetAssembly(string assemblyName)
		{
			return AccessTools.AllAssemblies().FirstOrDefault((Assembly assembly) => assembly.GetName().Name.Equals(assemblyName, StringComparison.OrdinalIgnoreCase));
		}
	}
	public abstract class SpawnStrategy
	{
		public abstract List<SpawnPositionData> CalculateCenterPositions(Vector3 shipLandPosition, Vector3 mainEntrancePosition, List<Vector3> pointsOfInterest, float spawnRadiusMultiplier);

		protected SpawnPositionData CalculateCenterWithSpawnRadius(Vector3 shipLandPosition, Vector3 targetPosition, float spawnRadiusMultiplier)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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)
			Vector3 val = (shipLandPosition + targetPosition) / 2f;
			float spawnRadius = Vector3.Distance(targetPosition, val) * spawnRadiusMultiplier;
			val.y = Mathf.Max(shipLandPosition.y, targetPosition.y);
			return new SpawnPositionData(val, spawnRadius);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}