Decompiled source of RollerBallMine v1.0.2

RollerBallMine.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using GameNetcodeStuff;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using RandomEnemiesSize;
using StaticNetcodeLib;
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: AssemblyCompany("RollerBallMine")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("RollerBallMine")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7c2e4adc9b241088f9950c3f94fe80a7cb714b34")]
[assembly: AssemblyProduct("RollerBallMine")]
[assembly: AssemblyTitle("RollerBallMine")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 RollerBallMine
{
	[BepInPlugin("wexop.roller_ball_mine", "RollerBallMine", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency("evaisa.lethallib", "0.15.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class RollerBallMinePlugin : BaseUnityPlugin
	{
		private const string GUID = "wexop.roller_ball_mine";

		private const string NAME = "RollerBallMine";

		private const string VERSION = "1.0.2";

		public static RollerBallMinePlugin instance;

		public ConfigEntry<int> maxSpawn;

		public ConfigEntry<int> minSpawn;

		public ConfigEntry<float> Speed;

		public ConfigEntry<float> TriggerRadius;

		public ConfigEntry<float> ExplodeTime;

		public ConfigEntry<float> ExplosionRange;

		public ConfigEntry<int> ExplosionDamage;

		public ConfigEntry<float> DetectionRange;

		public ConfigEntry<float> SoundVolume;

		public ConfigEntry<bool> DebugMode;

		public GameObject ballObject;

		private void Update()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			if (!DebugMode.Value)
			{
				return;
			}
			float num = IngamePlayerSettings.Instance.playerInput.actions.FindAction("Discard", false).ReadValue<float>();
			if (num > 0f && (Object)(object)ballObject != (Object)null)
			{
				GameObject val = Object.Instantiate<GameObject>(ballObject, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position + ((Component)GameNetworkManager.Instance.localPlayerController).transform.forward * 15f, Quaternion.identity);
				NetworkObject component = val.GetComponent<NetworkObject>();
				if (component.IsOwner)
				{
					component.Spawn(false);
				}
			}
		}

		private void addRandomSizeComponent()
		{
			if ((Object)(object)ballObject.GetComponent<MapHazardSizeRandomizer>() == (Object)null)
			{
				ballObject.AddComponent<MapHazardSizeRandomizer>();
			}
		}

		private void Awake()
		{
			instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"RollerBallMine starting....");
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "rollerballmine");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			LoadConfigs();
			SpawnableMapObjectDef rollerBall = val.LoadAsset<SpawnableMapObjectDef>("Assets/LethalCompany/Mods/RollerBallMine/RollerBallMine.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)rollerBall.spawnableMapObject.prefabToSpawn).name + " FOUND"));
			ballObject = rollerBall.spawnableMapObject.prefabToSpawn;
			if (Chainloader.PluginInfos.ContainsKey("wexop.random_enemies_size"))
			{
				Debug.Log((object)"RandomEnemiesSize is here !");
				addRandomSizeComponent();
			}
			((Keyframe)(ref rollerBall.spawnableMapObject.numberToSpawn.keys[0])).value = instance.minSpawn.Value;
			((Keyframe)(ref rollerBall.spawnableMapObject.numberToSpawn.keys[1])).value = instance.maxSpawn.Value;
			NetworkPrefabs.RegisterNetworkPrefab(rollerBall.spawnableMapObject.prefabToSpawn);
			Utilities.FixMixerGroups(rollerBall.spawnableMapObject.prefabToSpawn);
			MapObjects.RegisterMapObject(rollerBall, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel _) => rollerBall.spawnableMapObject.numberToSpawn));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"RollerBallMine is ready!");
		}

		public static string ConditionalString(string value)
		{
			string text = value.ToLower();
			while (text.Contains(" "))
			{
				text = text.Replace(" ", "");
			}
			return text;
		}

		private void LoadConfigs()
		{
			minSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MinSpawn", 0, "Min RollerBallMine possible for one game. You need to restart the game.");
			CreateIntConfig(minSpawn);
			maxSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxSpawn", 7, "Max RollerBallMine possible for one game. You need to restart the game.");
			CreateIntConfig(maxSpawn);
			Speed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Speed", 5f, "RollerBallMine speed. You don't need to restart the game :)");
			CreateFloatConfig(Speed, 0f, 40f);
			TriggerRadius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "TriggerRadius", 0.5f, "RollerBallMine distance with player to explode. You don't need to restart the game :)");
			CreateFloatConfig(TriggerRadius, 0f, 10f);
			ExplodeTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ExplodeTime", 3f, "RollerBallMine time to explode if it don't touch any player. You don't need to restart the game :)");
			CreateFloatConfig(ExplodeTime, 0f, 10f);
			ExplosionRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ExplosionRange", 4f, "RollerBallMine explosion range. You don't need to restart the game :)");
			CreateFloatConfig(ExplosionRange, 0f, 30f);
			ExplosionDamage = ((BaseUnityPlugin)this).Config.Bind<int>("General", "ExplosionDamage", 100, "RollerBallMine explosion damage to player. You don't need to restart the game :)");
			CreateIntConfig(ExplosionDamage);
			DetectionRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DetectionRange", 10f, "RollerBallMine player detection distance. You don't need to restart the game :)");
			CreateFloatConfig(DetectionRange);
			SoundVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Sound", "SoundVolume", 0.6f, "RollerBallMine sounds volume. You don't need to restart the game :)");
			CreateFloatConfig(SoundVolume, 0f, 2f);
			DebugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("DEV", "DebugMode", false, "Enable dev mod to spawn balls with [G]. You don't need to restart the game :)");
			CreateBoolConfig(DebugMode);
		}

		private void CreateFloatConfig(ConfigEntry<float> configEntry, float min = 0f, float max = 100f)
		{
			//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_000e: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			FloatSliderOptions val = new FloatSliderOptions();
			((BaseRangeOptions<float>)val).Min = min;
			((BaseRangeOptions<float>)val).Max = max;
			((BaseOptions)val).RequiresRestart = false;
			FloatSliderConfigItem val2 = new FloatSliderConfigItem(configEntry, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		}

		private void CreateIntConfig(ConfigEntry<int> configEntry, int min = 0, int max = 100)
		{
			//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_000e: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			IntSliderOptions val = new IntSliderOptions();
			((BaseRangeOptions<int>)val).Min = min;
			((BaseRangeOptions<int>)val).Max = max;
			((BaseOptions)val).RequiresRestart = false;
			IntSliderConfigItem val2 = new IntSliderConfigItem(configEntry, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		}

		private void CreateStringConfig(ConfigEntry<string> configEntry, bool requireRestart = false)
		{
			//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_0014: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			TextInputFieldConfigItem val = new TextInputFieldConfigItem(configEntry, new TextInputFieldOptions
			{
				RequiresRestart = requireRestart
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}

		private void CreateBoolConfig(ConfigEntry<bool> configEntry, bool requireRestart = false)
		{
			//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_0014: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(configEntry, new BoolCheckBoxOptions
			{
				RequiresRestart = requireRestart
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "RollerBallMine";

		public const string PLUGIN_NAME = "RollerBallMine";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace RollerBallMine.Utils
{
	public class RegisterUtil
	{
		public static void RegisterEnemyWithConfig(string configMoonRarity, EnemyType enemy, TerminalNode terminalNode, TerminalKeyword terminalKeyword, float powerLevel, int spawnCount)
		{
			enemy.MaxCount = spawnCount;
			enemy.PowerLevel = powerLevel;
			var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
			Enemies.RegisterEnemy(enemy, dictionary, dictionary2, terminalNode, terminalKeyword);
		}

		public static void RegisterScrapWithConfig(string configMoonRarity, Item scrap)
		{
			var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
			Items.RegisterScrap(scrap, dictionary, dictionary2);
		}

		public static void RegisterShopItemWithConfig(bool enabledScrap, Item item, TerminalNode terminalNode, int itemCost, string configMoonRarity)
		{
			Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, terminalNode, itemCost);
			if (enabledScrap)
			{
				RegisterScrapWithConfig(configMoonRarity, item);
			}
		}

		public static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity)
		{
			//IL_0099: 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)
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			foreach (string item in from s in configMoonRarity.Split(',')
				select s.Trim())
			{
				string[] array = item.Split(':');
				if (array.Length != 2)
				{
					continue;
				}
				string text = array[0];
				if (!int.TryParse(array[1], out var result))
				{
					continue;
				}
				if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
				{
					dictionary[result2] = result;
					continue;
				}
				string value = text + "Level";
				if (Enum.TryParse<LevelTypes>(value, ignoreCase: true, out result2))
				{
					dictionary[result2] = result;
				}
				else
				{
					dictionary2[text] = result;
				}
			}
			return (dictionary, dictionary2);
		}
	}
}
namespace RollerBallMine.Scripts
{
	[StaticNetcode]
	public class NetworkRollerBallMine
	{
		[ClientRpc]
		public static void DetectPlayerClientRpc(ulong networkId, Vector3 position)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			List<RollerBallMine> list = Object.FindObjectsByType<RollerBallMine>((FindObjectsSortMode)0).ToList();
			RollerBallMine rollerBallMine = list.Find((RollerBallMine e) => ((NetworkBehaviour)e).NetworkObjectId == networkId);
			if ((Object)(object)rollerBallMine == (Object)null)
			{
				Debug.LogError((object)$"ROLLER BALL NOT FOUND {networkId}");
			}
			else
			{
				rollerBallMine.DetectPlayer(position);
			}
		}

		[ClientRpc]
		public static void ExplodeClientRpc(ulong networkId)
		{
			List<RollerBallMine> list = Object.FindObjectsByType<RollerBallMine>((FindObjectsSortMode)0).ToList();
			RollerBallMine rollerBallMine = list.Find((RollerBallMine e) => ((NetworkBehaviour)e).NetworkObjectId == networkId);
			if ((Object)(object)rollerBallMine == (Object)null)
			{
				Debug.LogError((object)$"ROLLER BALL NOT FOUND {networkId}");
			}
			else
			{
				rollerBallMine.Explode();
			}
		}

		[ClientRpc]
		public static void SetValueClientRpc(ulong networkId, int value)
		{
			List<RollerBallMine> list = Object.FindObjectsByType<RollerBallMine>((FindObjectsSortMode)0).ToList();
			RollerBallMine rollerBallMine = list.Find((RollerBallMine e) => ((NetworkBehaviour)e).NetworkObjectId == networkId);
			if ((Object)(object)rollerBallMine == (Object)null)
			{
				Debug.LogError((object)$"ROLLER BALL NOT FOUND {networkId}");
			}
			else
			{
				rollerBallMine.SetValue(value);
			}
		}

		[ClientRpc]
		public static void UpdateValuesClientRpc(ulong networkId, RollerBallMineValues values)
		{
			List<RollerBallMine> list = Object.FindObjectsByType<RollerBallMine>((FindObjectsSortMode)0).ToList();
			RollerBallMine rollerBallMine = list.Find((RollerBallMine e) => ((NetworkBehaviour)e).NetworkObjectId == networkId);
			if ((Object)(object)rollerBallMine == (Object)null)
			{
				Debug.LogError((object)$"ROLLER BALL NOT FOUND {networkId}");
			}
			else
			{
				rollerBallMine.UpdateValues(values);
			}
		}
	}
	public class RollerBallMine : NetworkBehaviour, IHittable
	{
		private static readonly int Run = Animator.StringToHash("run");

		private static readonly int Open = Animator.StringToHash("open");

		public GameObject model;

		public Animator modelAnimator;

		public Animator spikeAnimator;

		public NavMeshAgent navMeshAgent;

		public AudioSource sfxAudioSource;

		public AudioSource runAudioSource;

		public AudioClip explodeClip;

		public AudioClip activateClip;

		public AudioClip runClip;

		public ParticleSystem explosion;

		public float speed = 5f;

		private float explosionRange = 5f;

		private int explosionDamage = 100;

		private float detectionRange = 10f;

		private bool detected;

		private bool hasExploded;

		private float explodeTime = 3f;

		private float detectPlayerRadius = 0.5f;

		public void SetValue(int value)
		{
			ScanNodeProperties componentInChildren = ((Component)this).GetComponentInChildren<ScanNodeProperties>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.subText = $"Value: {value}";
			}
		}

		public void UpdateValues(RollerBallMineValues values)
		{
			explosionRange = values.ExplosionRange;
			explosionDamage = values.ExplosionDamage;
			detectionRange = values.DetectionRange;
			speed = values.Speed;
			explodeTime = values.ExplodeTime;
			detectPlayerRadius = values.TriggerRadius;
		}

		private void Start()
		{
			if (RollerBallMinePlugin.instance.DebugMode.Value)
			{
				Debug.Log((object)(((Object)((Component)this).gameObject).name + " spawned"));
			}
			explodeTime = RollerBallMinePlugin.instance.ExplodeTime.Value;
			detectPlayerRadius = RollerBallMinePlugin.instance.TriggerRadius.Value;
			detectionRange = RollerBallMinePlugin.instance.DetectionRange.Value;
			explosionDamage = RollerBallMinePlugin.instance.ExplosionDamage.Value;
			speed = RollerBallMinePlugin.instance.Speed.Value;
			explosionRange = RollerBallMinePlugin.instance.ExplosionRange.Value;
			runAudioSource.volume = RollerBallMinePlugin.instance.SoundVolume.Value;
			sfxAudioSource.volume = RollerBallMinePlugin.instance.SoundVolume.Value;
			if (((NetworkBehaviour)this).IsServer)
			{
				NetworkRollerBallMine.SetValueClientRpc(((NetworkBehaviour)this).NetworkBehaviourId, Random.Range(40, 70));
			}
			((Behaviour)navMeshAgent).enabled = true;
			RollerBallMineValues rollerBallMineValues = new RollerBallMineValues();
			rollerBallMineValues.ExplosionRange = explosionRange;
			rollerBallMineValues.ExplosionDamage = explosionDamage;
			rollerBallMineValues.DetectionRange = detectionRange;
			rollerBallMineValues.Speed = speed;
			rollerBallMineValues.ExplodeTime = explodeTime;
			rollerBallMineValues.TriggerRadius = detectPlayerRadius;
			NetworkRollerBallMine.UpdateValuesClientRpc(((NetworkBehaviour)this).NetworkBehaviourId, rollerBallMineValues);
		}

		private void Update()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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)
			if (hasExploded)
			{
				return;
			}
			if (detected)
			{
				explodeTime -= Time.deltaTime;
				if (explodeTime <= 0f && ((NetworkBehaviour)this).IsServer)
				{
					NetworkRollerBallMine.ExplodeClientRpc(((NetworkBehaviour)this).NetworkObjectId);
				}
				navMeshAgent.Move(((Component)this).transform.forward * speed * Time.deltaTime);
				StartOfRound.Instance.allPlayerScripts.ToList().ForEach(delegate(PlayerControllerB 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)
					if (Vector3.Distance(((Component)this).transform.position, ((Component)player).transform.position) <= detectPlayerRadius && ((NetworkBehaviour)this).IsServer)
					{
						NetworkRollerBallMine.ExplodeClientRpc(((NetworkBehaviour)this).NetworkObjectId);
					}
				});
				return;
			}
			StartOfRound.Instance.allPlayerScripts.ToList().ForEach(delegate(PlayerControllerB player)
			{
				//IL_001b: 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_0048: 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_006c: 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)
				if (Vector3.Distance(((Component)this).transform.position, ((Component)player).transform.position) <= detectionRange && Vector3.Distance(new Vector3(0f, ((Component)this).transform.position.y, 0f), new Vector3(0f, ((Component)player).transform.position.y, 0f)) <= 2f)
				{
					StartOfRound.Instance.allPlayerScripts.ToList().ForEach(delegate(PlayerControllerB p)
					{
						//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_001b: Unknown result type (might be due to invalid IL or missing references)
						//IL_0020: 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_006c: Unknown result type (might be due to invalid IL or missing references)
						if (!Physics.Linecast(((Component)this).transform.position + Vector3.up * 0.25f, ((Component)p).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && ((NetworkBehaviour)this).IsServer)
						{
							NetworkRollerBallMine.DetectPlayerClientRpc(((NetworkBehaviour)this).NetworkObjectId, ((Component)player).transform.position);
						}
					});
				}
			});
		}

		public void DetectPlayer(Vector3 pos)
		{
			//IL_000e: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			detected = true;
			((Component)this).transform.LookAt(pos);
			((Component)this).transform.eulerAngles = new Vector3(0f, ((Component)this).transform.eulerAngles.y, 0f);
			modelAnimator.SetBool(Run, true);
			spikeAnimator.SetBool(Open, true);
			runAudioSource.clip = runClip;
			runAudioSource.Play();
			sfxAudioSource.PlayOneShot(activateClip);
		}

		public void Explode()
		{
			//IL_0050: 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_008e: 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)
			if (hasExploded)
			{
				return;
			}
			hasExploded = true;
			runAudioSource.Stop();
			explosion.Play();
			sfxAudioSource.PlayOneShot(explodeClip);
			if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) <= explosionRange)
			{
				GameNetworkManager.Instance.localPlayerController.DamagePlayer(explosionDamage, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
			}
			List<EnemyAI> list = Object.FindObjectsOfType<EnemyAI>().ToList();
			list.ForEach(delegate(EnemyAI enemy)
			{
				//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)
				if (Vector3.Distance(((Component)enemy).transform.position, ((Component)this).transform.position) <= explosionRange)
				{
					enemy.HitEnemy(5, (PlayerControllerB)null, false, -1);
				}
			});
			List<Landmine> list2 = Object.FindObjectsOfType<Landmine>().ToList();
			list2.ForEach(delegate(Landmine mine)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				if (!mine.hasExploded && Vector3.Distance(((Component)mine).transform.position, ((Component)this).transform.position) <= explosionRange && ((NetworkBehaviour)this).IsServer)
				{
					mine.ExplodeMineServerRpc();
				}
			});
			List<RollerBallMine> list3 = Object.FindObjectsOfType<RollerBallMine>().ToList();
			list3.ForEach(delegate(RollerBallMine mine)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				if (!mine.hasExploded && Vector3.Distance(((Component)mine).transform.position, ((Component)this).transform.position) <= explosionRange && ((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)mine).NetworkObjectId != ((NetworkBehaviour)this).NetworkObjectId)
				{
					NetworkRollerBallMine.ExplodeClientRpc(((NetworkBehaviour)mine).NetworkObjectId);
				}
			});
			((MonoBehaviour)this).StartCoroutine(DestroyObject());
		}

		public IEnumerator DestroyObject()
		{
			model.SetActive(false);
			yield return (object)new WaitForSeconds(1f);
			if (((NetworkBehaviour)this).IsServer)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				NetworkRollerBallMine.ExplodeClientRpc(((NetworkBehaviour)this).NetworkObjectId);
			}
			return true;
		}

		private void OnTriggerEnter(Collider other)
		{
			if ((((Component)other).CompareTag("Player") || ((Component)other).CompareTag("Enemy")) && ((NetworkBehaviour)this).IsServer)
			{
				NetworkRollerBallMine.ExplodeClientRpc(((NetworkBehaviour)this).NetworkObjectId);
			}
		}
	}
	public class RollerBallMineValues
	{
		public float Speed;

		public float TriggerRadius;

		public float ExplodeTime;

		public float ExplosionRange;

		public int ExplosionDamage;

		public float DetectionRange;
	}
}