Decompiled source of HardcoreExplosives v1.0.0

HardcoreExplosives.dll

Decompiled 9 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using ComputerysModdingUtilities;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: StraftatMod(false)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("HardcoreExplosives")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+035ee42632884b38ea937935eb423d7c7e886381")]
[assembly: AssemblyProduct("HardcoreExplosives")]
[assembly: AssemblyTitle("HardcoreExplosives")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HardcoreExplosives
{
	internal static class ModMenuCard
	{
		private const string ModMenuGuid = "kestrel.straftat.modmenu";

		private const string ApiType = "ModMenu.Api.ModMenuCustomisation";

		private const string IconResource = "HardcoreExplosives.Resources.icon.png";

		private const string Description = "Hides mine and grenade radius indicators. Not vanilla compatible: everyone in your lobby runs the same modded set, so nobody sees it either.";

		public static void Apply(ManualLogSource log)
		{
			if (!Chainloader.PluginInfos.TryGetValue("kestrel.straftat.modmenu", out var value))
			{
				log.LogInfo((object)"[ModMenu] not installed - nothing to decorate");
				return;
			}
			Type type = AccessTools.TypeByName("ModMenu.Api.ModMenuCustomisation");
			if (type == null)
			{
				log.LogWarning((object)(string.Format("[ModMenu] plugin {0} found but type {1} is missing - ", value.Metadata.Version, "ModMenu.Api.ModMenuCustomisation") + "the API changed, decoration skipped"));
				return;
			}
			try
			{
				if (TryRegister(type, "Descriptions", "Hides mine and grenade radius indicators. Not vanilla compatible: everyone in your lobby runs the same modded set, so nobody sees it either.", log))
				{
					log.LogInfo((object)"[ModMenu] description registered for cmr.hardcoreexplosives");
				}
				Sprite val = LoadIcon(log);
				if ((Object)(object)val != (Object)null && TryRegister(type, "Icons", val, log))
				{
					log.LogInfo((object)"[ModMenu] icon registered for cmr.hardcoreexplosives");
				}
			}
			catch (Exception ex)
			{
				log.LogWarning((object)("[ModMenu] card not set: " + ex.GetType().Name + ": " + ex.Message));
			}
		}

		private static bool TryRegister(Type api, string property, object value, ManualLogSource log)
		{
			PropertyInfo propertyInfo = AccessTools.Property(api, property);
			if (propertyInfo == null)
			{
				log.LogWarning((object)("[ModMenu] " + property + " is absent - the API changed"));
				return false;
			}
			if (!(propertyInfo.GetValue(null, null) is IDictionary dictionary))
			{
				log.LogWarning((object)("[ModMenu] " + property + " is not a dictionary - the API changed"));
				return false;
			}
			dictionary["cmr.hardcoreexplosives"] = value;
			return true;
		}

		private static Sprite LoadIcon(ManualLogSource log)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_00b0: 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)
			byte[] array;
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HardcoreExplosives.Resources.icon.png"))
			{
				if (stream == null)
				{
					log.LogWarning((object)"[ModMenu] icon resource HardcoreExplosives.Resources.icon.png not found");
					return null;
				}
				array = new byte[stream.Length];
				int num;
				for (int i = 0; i < array.Length; i += num)
				{
					num = stream.Read(array, i, array.Length - i);
					if (num <= 0)
					{
						break;
					}
				}
			}
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			if (!ImageConversion.LoadImage(val, array))
			{
				log.LogWarning((object)"[ModMenu] icon PNG could not be decoded");
				return null;
			}
			((Object)val).hideFlags = (HideFlags)61;
			((Object)val).name = "HardcoreExplosives_Icon";
			Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			((Object)obj).hideFlags = (HideFlags)61;
			((Object)obj).name = ((Object)val).name;
			log.LogInfo((object)$"[ModMenu] icon loaded: {((Texture)val).width}x{((Texture)val).height}");
			return obj;
		}
	}
	[BepInPlugin("cmr.hardcoreexplosives", "HardcoreExplosives", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class HardcoreExplosivesPlugin : BaseUnityPlugin
	{
		public const string ModGuid = "cmr.hardcoreexplosives";

		public const string ModName = "HardcoreExplosives";

		private const string SiblingGuid = "cmr.hardcoreexplosives.vanilla";

		public const string ModVersion = "1.0.0";

		public static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"HardcoreExplosives 1.0.0 - starting");
			if (Chainloader.PluginInfos.ContainsKey("cmr.hardcoreexplosives.vanilla"))
			{
				Log.LogError((object)"cmr.hardcoreexplosives: both HardcoreExplosives variants are installed (cmr.hardcoreexplosives and cmr.hardcoreexplosives.vanilla). Matchmaking will use the non-vanilla compatible pool. Remove one of them.");
			}
			try
			{
				RadiusHider.Apply(Log);
			}
			catch (Exception ex)
			{
				Log.LogError((object)("[Radius] failed: " + ex.GetType().Name + ": " + ex.Message));
			}
			try
			{
				ModMenuCard.Apply(Log);
			}
			catch (Exception ex2)
			{
				Log.LogError((object)("[ModMenu] card failed: " + ex2.GetType().Name + ": " + ex2.Message));
			}
			Log.LogInfo((object)"HardcoreExplosives 1.0.0 - ready");
		}
	}
	internal static class RadiusHider
	{
		private enum HideResult
		{
			Hidden,
			AlreadyHidden,
			NoSuchChild
		}

		private const string WeaponsResourcePath = "RandomWeapons";

		private static readonly string[] SpawnedMarkerTypes = new string[8] { "PredictedProjectile", "ShrapnelBallistic", "PhysicsGrenade", "ProximityMine", "Claymore", "Obus", "HandGrenadeTwo", "RebondBalle" };

		public static void Apply(ManualLogSource log)
		{
			List<GameObject> list = CollectSpawned(log);
			if (list.Count == 0)
			{
				log.LogWarning((object)"[Radius] no spawned prefabs found - nothing to hide. Did the Resources path or the marker components change?");
				return;
			}
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			RadiusTarget[] all = RadiusTargets.All;
			for (int i = 0; i < all.Length; i++)
			{
				RadiusTarget target = all[i];
				GameObject val = list.Find((GameObject go) => string.Equals(((Object)go).name, target.Prefab, StringComparison.OrdinalIgnoreCase));
				if ((Object)(object)val == (Object)null)
				{
					log.LogWarning((object)("[Radius] prefab '" + target.Prefab + "' not found among spawned objects"));
					num3++;
					continue;
				}
				switch (HideChild(val, target.Child))
				{
				case HideResult.Hidden:
					log.LogInfo((object)("[Radius] " + target.Prefab + "/" + target.Child + ": hidden"));
					num++;
					break;
				case HideResult.AlreadyHidden:
					num2++;
					break;
				case HideResult.NoSuchChild:
					log.LogWarning((object)("[Radius] " + target.Prefab + ": no child named '" + target.Child + "'"));
					num3++;
					break;
				}
			}
			log.LogInfo((object)$"[Radius] {num} hidden, {num2} already hidden, {num3} not found");
		}

		private static HideResult HideChild(GameObject root, string childName)
		{
			Transform val = root.transform.Find(childName);
			if ((Object)(object)val != (Object)null)
			{
				return Deactivate(val);
			}
			Queue<Transform> queue = new Queue<Transform>();
			queue.Enqueue(root.transform);
			while (queue.Count > 0)
			{
				Transform val2 = queue.Dequeue();
				if ((Object)(object)val2 != (Object)(object)root.transform && ((Object)val2).name == childName)
				{
					return Deactivate(val2);
				}
				for (int i = 0; i < val2.childCount; i++)
				{
					queue.Enqueue(val2.GetChild(i));
				}
			}
			return HideResult.NoSuchChild;
		}

		private static HideResult Deactivate(Transform t)
		{
			if (!((Component)t).gameObject.activeSelf)
			{
				return HideResult.AlreadyHidden;
			}
			((Component)t).gameObject.SetActive(false);
			return HideResult.Hidden;
		}

		private static List<GameObject> CollectSpawned(ManualLogSource log)
		{
			//IL_0111: 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)
			GameObject[] array = (GameObject[])(((object)Resources.LoadAll<GameObject>("RandomWeapons")) ?? ((object)new GameObject[0]));
			log.LogInfo((object)string.Format("[Radius] LoadAll(\"{0}\") -> {1} pickups", "RandomWeapons", array.Length));
			HashSet<int> hashSet = new HashSet<int>();
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				if ((Object)(object)val != (Object)null)
				{
					hashSet.Add(((Object)val).GetInstanceID());
				}
			}
			Dictionary<int, GameObject> dictionary = new Dictionary<int, GameObject>();
			string[] spawnedMarkerTypes = SpawnedMarkerTypes;
			foreach (string text in spawnedMarkerTypes)
			{
				Type type = AccessTools.TypeByName(text);
				if (type == null)
				{
					log.LogWarning((object)("[Radius] type " + text + " not found - did the game update?"));
					continue;
				}
				Object[] array3;
				try
				{
					array3 = Resources.FindObjectsOfTypeAll(type);
				}
				catch (Exception ex)
				{
					log.LogWarning((object)("[Radius] " + text + ": " + ex.Message));
					continue;
				}
				Object[] array4 = array3;
				foreach (Object obj in array4)
				{
					Component val2 = (Component)(object)((obj is Component) ? obj : null);
					if (val2 != null)
					{
						GameObject gameObject = ((Component)val2.transform.root).gameObject;
						Scene scene = gameObject.scene;
						if (!((Scene)(ref scene)).IsValid() && !hashSet.Contains(((Object)gameObject).GetInstanceID()))
						{
							dictionary[((Object)gameObject).GetInstanceID()] = gameObject;
						}
					}
				}
			}
			log.LogInfo((object)$"[Radius] spawned prefabs: {dictionary.Count}");
			return new List<GameObject>(dictionary.Values);
		}
	}
	internal struct RadiusTarget
	{
		public readonly string Prefab;

		public readonly string Child;

		public RadiusTarget(string prefab, string child)
		{
			Prefab = prefab;
			Child = child;
		}
	}
	internal static class RadiusTargets
	{
		public static readonly RadiusTarget[] All = new RadiusTarget[5]
		{
			new RadiusTarget("ProximityMine", "radius"),
			new RadiusTarget("HandGrenade 2", "Sphere (1)"),
			new RadiusTarget("PhysicsHandGrenade", "Sphere (1)"),
			new RadiusTarget("StunGrenade", "Sphere (1)"),
			new RadiusTarget("StunMineObject", "radius")
		};
	}
}

HardcoreExplosives.VanillaCompatible.dll.disabled

Decompiled 9 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using ComputerysModdingUtilities;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: StraftatMod(true)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("HardcoreExplosives.VanillaCompatible")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+035ee42632884b38ea937935eb423d7c7e886381")]
[assembly: AssemblyProduct("HardcoreExplosives")]
[assembly: AssemblyTitle("HardcoreExplosives (vanilla compatible)")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HardcoreExplosives
{
	internal static class ModMenuCard
	{
		private const string ModMenuGuid = "kestrel.straftat.modmenu";

		private const string ApiType = "ModMenu.Api.ModMenuCustomisation";

		private const string IconResource = "HardcoreExplosives.Resources.icon.png";

		private const string Description = "Hides mine and grenade radius indicators. Vanilla compatible: you keep playing with everyone, you just cannot see the radius yourself.";

		public static void Apply(ManualLogSource log)
		{
			if (!Chainloader.PluginInfos.TryGetValue("kestrel.straftat.modmenu", out var value))
			{
				log.LogInfo((object)"[ModMenu] not installed - nothing to decorate");
				return;
			}
			Type type = AccessTools.TypeByName("ModMenu.Api.ModMenuCustomisation");
			if (type == null)
			{
				log.LogWarning((object)(string.Format("[ModMenu] plugin {0} found but type {1} is missing - ", value.Metadata.Version, "ModMenu.Api.ModMenuCustomisation") + "the API changed, decoration skipped"));
				return;
			}
			try
			{
				if (TryRegister(type, "Descriptions", "Hides mine and grenade radius indicators. Vanilla compatible: you keep playing with everyone, you just cannot see the radius yourself.", log))
				{
					log.LogInfo((object)"[ModMenu] description registered for cmr.hardcoreexplosives.vanilla");
				}
				Sprite val = LoadIcon(log);
				if ((Object)(object)val != (Object)null && TryRegister(type, "Icons", val, log))
				{
					log.LogInfo((object)"[ModMenu] icon registered for cmr.hardcoreexplosives.vanilla");
				}
			}
			catch (Exception ex)
			{
				log.LogWarning((object)("[ModMenu] card not set: " + ex.GetType().Name + ": " + ex.Message));
			}
		}

		private static bool TryRegister(Type api, string property, object value, ManualLogSource log)
		{
			PropertyInfo propertyInfo = AccessTools.Property(api, property);
			if (propertyInfo == null)
			{
				log.LogWarning((object)("[ModMenu] " + property + " is absent - the API changed"));
				return false;
			}
			if (!(propertyInfo.GetValue(null, null) is IDictionary dictionary))
			{
				log.LogWarning((object)("[ModMenu] " + property + " is not a dictionary - the API changed"));
				return false;
			}
			dictionary["cmr.hardcoreexplosives.vanilla"] = value;
			return true;
		}

		private static Sprite LoadIcon(ManualLogSource log)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_00b0: 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)
			byte[] array;
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HardcoreExplosives.Resources.icon.png"))
			{
				if (stream == null)
				{
					log.LogWarning((object)"[ModMenu] icon resource HardcoreExplosives.Resources.icon.png not found");
					return null;
				}
				array = new byte[stream.Length];
				int num;
				for (int i = 0; i < array.Length; i += num)
				{
					num = stream.Read(array, i, array.Length - i);
					if (num <= 0)
					{
						break;
					}
				}
			}
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			if (!ImageConversion.LoadImage(val, array))
			{
				log.LogWarning((object)"[ModMenu] icon PNG could not be decoded");
				return null;
			}
			((Object)val).hideFlags = (HideFlags)61;
			((Object)val).name = "HardcoreExplosives_Icon";
			Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			((Object)obj).hideFlags = (HideFlags)61;
			((Object)obj).name = ((Object)val).name;
			log.LogInfo((object)$"[ModMenu] icon loaded: {((Texture)val).width}x{((Texture)val).height}");
			return obj;
		}
	}
	[BepInPlugin("cmr.hardcoreexplosives.vanilla", "HardcoreExplosives (Vanilla Compatible)", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class HardcoreExplosivesPlugin : BaseUnityPlugin
	{
		public const string ModGuid = "cmr.hardcoreexplosives.vanilla";

		public const string ModName = "HardcoreExplosives (Vanilla Compatible)";

		private const string SiblingGuid = "cmr.hardcoreexplosives";

		public const string ModVersion = "1.0.0";

		public static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"HardcoreExplosives (Vanilla Compatible) 1.0.0 - starting");
			if (Chainloader.PluginInfos.ContainsKey("cmr.hardcoreexplosives"))
			{
				Log.LogError((object)"cmr.hardcoreexplosives.vanilla: both HardcoreExplosives variants are installed (cmr.hardcoreexplosives.vanilla and cmr.hardcoreexplosives). Matchmaking will use the non-vanilla compatible pool. Remove one of them.");
			}
			try
			{
				RadiusHider.Apply(Log);
			}
			catch (Exception ex)
			{
				Log.LogError((object)("[Radius] failed: " + ex.GetType().Name + ": " + ex.Message));
			}
			try
			{
				ModMenuCard.Apply(Log);
			}
			catch (Exception ex2)
			{
				Log.LogError((object)("[ModMenu] card failed: " + ex2.GetType().Name + ": " + ex2.Message));
			}
			Log.LogInfo((object)"HardcoreExplosives (Vanilla Compatible) 1.0.0 - ready");
		}
	}
	internal static class RadiusHider
	{
		private enum HideResult
		{
			Hidden,
			AlreadyHidden,
			NoSuchChild
		}

		private const string WeaponsResourcePath = "RandomWeapons";

		private static readonly string[] SpawnedMarkerTypes = new string[8] { "PredictedProjectile", "ShrapnelBallistic", "PhysicsGrenade", "ProximityMine", "Claymore", "Obus", "HandGrenadeTwo", "RebondBalle" };

		public static void Apply(ManualLogSource log)
		{
			List<GameObject> list = CollectSpawned(log);
			if (list.Count == 0)
			{
				log.LogWarning((object)"[Radius] no spawned prefabs found - nothing to hide. Did the Resources path or the marker components change?");
				return;
			}
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			RadiusTarget[] all = RadiusTargets.All;
			for (int i = 0; i < all.Length; i++)
			{
				RadiusTarget target = all[i];
				GameObject val = list.Find((GameObject go) => string.Equals(((Object)go).name, target.Prefab, StringComparison.OrdinalIgnoreCase));
				if ((Object)(object)val == (Object)null)
				{
					log.LogWarning((object)("[Radius] prefab '" + target.Prefab + "' not found among spawned objects"));
					num3++;
					continue;
				}
				switch (HideChild(val, target.Child))
				{
				case HideResult.Hidden:
					log.LogInfo((object)("[Radius] " + target.Prefab + "/" + target.Child + ": hidden"));
					num++;
					break;
				case HideResult.AlreadyHidden:
					num2++;
					break;
				case HideResult.NoSuchChild:
					log.LogWarning((object)("[Radius] " + target.Prefab + ": no child named '" + target.Child + "'"));
					num3++;
					break;
				}
			}
			log.LogInfo((object)$"[Radius] {num} hidden, {num2} already hidden, {num3} not found");
		}

		private static HideResult HideChild(GameObject root, string childName)
		{
			Transform val = root.transform.Find(childName);
			if ((Object)(object)val != (Object)null)
			{
				return Deactivate(val);
			}
			Queue<Transform> queue = new Queue<Transform>();
			queue.Enqueue(root.transform);
			while (queue.Count > 0)
			{
				Transform val2 = queue.Dequeue();
				if ((Object)(object)val2 != (Object)(object)root.transform && ((Object)val2).name == childName)
				{
					return Deactivate(val2);
				}
				for (int i = 0; i < val2.childCount; i++)
				{
					queue.Enqueue(val2.GetChild(i));
				}
			}
			return HideResult.NoSuchChild;
		}

		private static HideResult Deactivate(Transform t)
		{
			if (!((Component)t).gameObject.activeSelf)
			{
				return HideResult.AlreadyHidden;
			}
			((Component)t).gameObject.SetActive(false);
			return HideResult.Hidden;
		}

		private static List<GameObject> CollectSpawned(ManualLogSource log)
		{
			//IL_0111: 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)
			GameObject[] array = (GameObject[])(((object)Resources.LoadAll<GameObject>("RandomWeapons")) ?? ((object)new GameObject[0]));
			log.LogInfo((object)string.Format("[Radius] LoadAll(\"{0}\") -> {1} pickups", "RandomWeapons", array.Length));
			HashSet<int> hashSet = new HashSet<int>();
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				if ((Object)(object)val != (Object)null)
				{
					hashSet.Add(((Object)val).GetInstanceID());
				}
			}
			Dictionary<int, GameObject> dictionary = new Dictionary<int, GameObject>();
			string[] spawnedMarkerTypes = SpawnedMarkerTypes;
			foreach (string text in spawnedMarkerTypes)
			{
				Type type = AccessTools.TypeByName(text);
				if (type == null)
				{
					log.LogWarning((object)("[Radius] type " + text + " not found - did the game update?"));
					continue;
				}
				Object[] array3;
				try
				{
					array3 = Resources.FindObjectsOfTypeAll(type);
				}
				catch (Exception ex)
				{
					log.LogWarning((object)("[Radius] " + text + ": " + ex.Message));
					continue;
				}
				Object[] array4 = array3;
				foreach (Object obj in array4)
				{
					Component val2 = (Component)(object)((obj is Component) ? obj : null);
					if (val2 != null)
					{
						GameObject gameObject = ((Component)val2.transform.root).gameObject;
						Scene scene = gameObject.scene;
						if (!((Scene)(ref scene)).IsValid() && !hashSet.Contains(((Object)gameObject).GetInstanceID()))
						{
							dictionary[((Object)gameObject).GetInstanceID()] = gameObject;
						}
					}
				}
			}
			log.LogInfo((object)$"[Radius] spawned prefabs: {dictionary.Count}");
			return new List<GameObject>(dictionary.Values);
		}
	}
	internal struct RadiusTarget
	{
		public readonly string Prefab;

		public readonly string Child;

		public RadiusTarget(string prefab, string child)
		{
			Prefab = prefab;
			Child = child;
		}
	}
	internal static class RadiusTargets
	{
		public static readonly RadiusTarget[] All = new RadiusTarget[5]
		{
			new RadiusTarget("ProximityMine", "radius"),
			new RadiusTarget("HandGrenade 2", "Sphere (1)"),
			new RadiusTarget("PhysicsHandGrenade", "Sphere (1)"),
			new RadiusTarget("StunGrenade", "Sphere (1)"),
			new RadiusTarget("StunMineObject", "radius")
		};
	}
}