Decompiled source of Glitchy Scrap v1.0.4

plugins/GlitchyScrap.dll

Decompiled 4 days 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 System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Dawn;
using Dawn.Utils;
using Dusk;
using Dusk.Weights;
using GlitchyScrap.Behaviours;
using GlitchyScrap.NetcodePatcher;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GlitchyScrap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4")]
[assembly: AssemblyProduct("GlitchyScrap")]
[assembly: AssemblyTitle("GlitchyScrap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
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 GlitchyScrap
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GlitchyScrap";

		public const string PLUGIN_NAME = "GlitchyScrap";

		public const string PLUGIN_VERSION = "1.0.4";
	}
}
namespace GlitchyScrap.src
{
	internal class GsContentHandler : ContentHandler<GsContentHandler>
	{
		public class ScrapConfig
		{
			public ConfigEntry<string>? MoonSpawnWeights;

			public ConfigEntry<string>? InteriorSpawnWeights;

			public ConfigEntry<string>? WeatherSpawnWeights;
		}

		public ScrapConfig? scrapConfig;

		public SpawnWeightsPreset SpawnWeights { get; private set; } = new SpawnWeightsPreset();


		public GsContentHandler(DuskMod mod)
			: base(mod)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Expected O, but got Unknown
			AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "gsassets");
			string[] allAssetNames = val.GetAllAssetNames();
			foreach (string text in allAssetNames)
			{
				if (Path.GetExtension(text) != ".asset")
				{
					continue;
				}
				DuskItemDefinition val2 = val.LoadAsset<DuskItemDefinition>(text);
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				ConfigContext val3 = mod.ConfigManager.CreateConfigSection(val2.Item.itemName + " Options");
				try
				{
					GrabbableObject component = val2.Item.spawnPrefab.GetComponent<GrabbableObject>();
					if (component is HoppingScrap hoppingScrap)
					{
						ConfigEntry<int> val4 = val3.Bind<int>("Jump Chance", "Chance for " + val2.Item.itemName + " to jump when dropped.", 40);
						ConfigEntry<BoundedRange> val5 = val3.Bind<BoundedRange>("Jump count", "Number of times " + val2.Item.itemName + " will jump.", new BoundedRange(3f, 7f));
						hoppingScrap.jumpChance = val4.Value;
						hoppingScrap.jumpCountMin = (int)val5.Value.Min;
						hoppingScrap.jumpCountMax = (int)val5.Value.Max + 1;
					}
					else if (component is VolatileScrap volatileScrap)
					{
						ConfigEntry<bool> val6 = val3.Bind<bool>("Explosive", "Whether " + val2.Item.itemName + " will react to explosions.", true);
						volatileScrap.explosionsEnabled = val6.Value;
					}
					scrapConfig = CreateItemConfig(val3, val2);
					SpawnWeights = new SpawnWeightsPreset();
					SpawnWeights.SetupSpawnWeightsPreset(NamespacedConfigWeight.ConvertManyFromString(scrapConfig.MoonSpawnWeights?.Value ?? string.Empty), NamespacedConfigWeight.ConvertManyFromString(scrapConfig.InteriorSpawnWeights?.Value ?? string.Empty), NamespacedConfigWeight.ConvertManyFromString(scrapConfig.WeatherSpawnWeights?.Value ?? string.Empty), 0);
					DawnLib.RegisterNetworkPrefab(val2.Item.spawnPrefab);
					DawnLib.DefineItem(((DuskContentDefinition<DawnItemInfo>)(object)val2).TypedKey, val2.Item, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
					{
						builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
						{
							scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
							{
								weightBuilder.SetGlobalWeight((IWeighted)(object)SpawnWeights);
							});
						});
					});
				}
				finally
				{
					((IDisposable)val3)?.Dispose();
				}
			}
		}

		public ScrapConfig CreateItemConfig(ConfigContext context, DuskItemDefinition duskItemDefinition)
		{
			return new ScrapConfig
			{
				MoonSpawnWeights = context.Bind<string>("Preset Moon Weights", "Preset moon weights for " + duskItemDefinition.Item.itemName + ".", NamespacedConfigWeight.ConvertManyToString(duskItemDefinition.MoonSpawnWeightsConfig)),
				InteriorSpawnWeights = context.Bind<string>("Preset Interior Weights", "Preset interior weights for " + duskItemDefinition.Item.itemName + ".", NamespacedConfigWeight.ConvertManyToString(duskItemDefinition.InteriorSpawnWeightsConfig)),
				WeatherSpawnWeights = context.Bind<string>("Preset Weather Weights", "Preset weather weights for " + duskItemDefinition.Item.itemName + ".", NamespacedConfigWeight.ConvertManyToString(duskItemDefinition.WeatherSpawnWeightsConfig))
			};
		}
	}
	[BepInPlugin("GlitchyScrap", "GlitchyScrap", "1.0.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string DawnDep = "com.github.teamxiaolan.dawnlib";

		public static DuskMod? Mod { get; private set; }

		private void Awake()
		{
			AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "gsmain");
			Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val);
			Mod.RegisterContentHandlers();
			ExplosiveScrap.PatchLandmines();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin GlitchyScrap is loaded!");
		}
	}
}
namespace GlitchyScrap.Behaviours
{
	internal class BallButWithActualRotation : SoccerBallProp
	{
		public override void Update()
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (!((GrabbableObject)this).wasOwnerLastFrame)
				{
					((GrabbableObject)this).wasOwnerLastFrame = true;
				}
			}
			else if (((GrabbableObject)this).wasOwnerLastFrame)
			{
				((GrabbableObject)this).wasOwnerLastFrame = false;
			}
			if (((GrabbableObject)this).isHeld || ((GrabbableObject)this).isHeldByEnemy)
			{
				return;
			}
			if (((GrabbableObject)this).fallTime < 1f)
			{
				((GrabbableObject)this).FallWithCurve();
				if (!((GrabbableObject)this).hasHitGround)
				{
					if (((Component)this).transform.localPosition.y - ((GrabbableObject)this).targetFloorPosition.y < 0.05f)
					{
						((GrabbableObject)this).PlayDropSFX();
						((GrabbableObject)this).OnHitGround();
					}
				}
				else if (((Component)this).transform.localPosition.y - ((GrabbableObject)this).targetFloorPosition.y > 0.05f)
				{
					((GrabbableObject)this).hasHitGround = false;
				}
			}
			else
			{
				((Component)this).transform.localPosition = ((GrabbableObject)this).targetFloorPosition;
			}
		}

		public override void FallWithCurve()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: 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_005e: 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_0083: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((GrabbableObject)this).targetFloorPosition - ((GrabbableObject)this).startFallingPosition;
			float magnitude = ((Vector3)(ref val)).magnitude;
			((Component)this).transform.localPosition = Vector3.Lerp(((GrabbableObject)this).startFallingPosition, ((GrabbableObject)this).targetFloorPosition, base.grenadeFallCurve.Evaluate(((GrabbableObject)this).fallTime));
			if (magnitude < 3f)
			{
				((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), base.grenadeVerticalFallCurveNoBounce.Evaluate(((GrabbableObject)this).fallTime));
			}
			else
			{
				((Component)this).transform.Rotate(Vector3.Cross(val, Vector3.up), 0f - magnitude / 6f, (Space)0);
				((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), base.grenadeVerticalFallCurve.Evaluate(((GrabbableObject)this).fallTime));
				((Component)this).transform.localPosition = new Vector3(((Component)this).transform.localPosition.x, ((Component)this).transform.localPosition.y + base.soccerBallVerticalOffset.Evaluate(((GrabbableObject)this).fallTime) * base.ballHitUpwardAmount, ((Component)this).transform.localPosition.z);
			}
			((GrabbableObject)this).fallTime = ((GrabbableObject)this).fallTime + Mathf.Abs(Time.deltaTime * 6f / magnitude);
		}

		protected override void __initializeVariables()
		{
			((SoccerBallProp)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			((SoccerBallProp)this).__initializeRpcs();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "BallButWithActualRotation";
		}
	}
	internal class HoppingScrap : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <IDoJumpingCoroutine>d__32 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public HoppingScrap <>4__this;

			public int counter;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <IDoJumpingCoroutine>d__32(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: 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_00f4: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_0115: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Expected O, but got Unknown
				int num = <>1__state;
				HoppingScrap hoppingScrap = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_004a;
				case 1:
					<>1__state = -1;
					goto IL_004a;
				case 2:
				{
					<>1__state = -1;
					Vector3 jumpTarget = hoppingScrap.GetJumpTarget();
					if (jumpTarget != Vector3.zero)
					{
						bool setInShipRoom = false;
						Bounds bounds = StartOfRound.Instance.shipBounds.bounds;
						bool setInElevator;
						if (!((Bounds)(ref bounds)).Contains(jumpTarget))
						{
							setInElevator = false;
							jumpTarget = StartOfRound.Instance.propsContainer.InverseTransformPoint(jumpTarget);
						}
						else
						{
							setInElevator = true;
							bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds;
							setInShipRoom = ((Bounds)(ref bounds)).Contains(jumpTarget);
							jumpTarget = StartOfRound.Instance.elevatorTransform.InverseTransformPoint(jumpTarget);
						}
						counter--;
						hoppingScrap.failsafeCount = 0;
						hoppingScrap.FrogJumpRPC(jumpTarget, setInElevator, setInShipRoom);
						goto IL_0137;
					}
					hoppingScrap.failsafeCount++;
					goto IL_0154;
				}
				case 3:
					<>1__state = -1;
					goto IL_0137;
				case 4:
					{
						<>1__state = -1;
						hoppingScrap.StopRpc();
						return false;
					}
					IL_004a:
					if (((GrabbableObject)hoppingScrap).fallTime < 1f)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					hoppingScrap.StartRPC();
					goto IL_0154;
					IL_0137:
					if (((GrabbableObject)hoppingScrap).fallTime < 1f)
					{
						<>2__current = null;
						<>1__state = 3;
						return true;
					}
					goto IL_0154;
					IL_0154:
					if (counter > 0 && hoppingScrap.failsafeCount < 5 && !((GrabbableObject)hoppingScrap).isInElevator)
					{
						<>2__current = (object)new WaitForSeconds(hoppingScrap.jumpDelay);
						<>1__state = 2;
						return true;
					}
					<>2__current = null;
					<>1__state = 4;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[Header("Falling Animation Curves")]
		public AnimationCurve JumpCurve;

		public float jumpHeight = 0.5f;

		[Header("Frog Specific FX")]
		public AudioClip jumpSound;

		public AudioClip windLoop;

		private Animator animator;

		private AudioSource audioSource;

		public float noiseRange = 16f;

		public float noiseLoudness = 1.6f;

		private int timesPlayedInOneSpot;

		private Vector3 lastPositionAtFart;

		[Header("Jump Parameters")]
		public float jumpDistance = 5f;

		public float jumpDelay = 0.6f;

		public float upwardClearance = 0.12f;

		public int jumpChance = 40;

		public int jumpCountMin = 3;

		public int jumpCountMax = 7;

		[Header("Restrictions")]
		public float wallAvoidance = 0.2f;

		public float maxFallHeight = 12f;

		public int slopeLimit = 45;

		public LayerMask hitMask = LayerMask.op_Implicit(369101569);

		[Header("Jump Update")]
		private Ray soccerRay;

		private RaycastHit soccerHit;

		private bool isJumping;

		private bool wasObjectPlaced;

		private int failsafeCount;

		private const int maxFailCount = 5;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			jumpCountMax = Mathf.Max(jumpCountMin, jumpCountMax);
			animator = ((Component)this).GetComponent<Animator>();
			audioSource = ((Component)this).GetComponent<AudioSource>();
			if ((Object)(object)windLoop != (Object)null)
			{
				audioSource.clip = windLoop;
				audioSource.loop = true;
			}
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			((MonoBehaviour)this).StopCoroutine("IDoJumpingCoroutine");
			StopRpc();
		}

		public override void OnHitGround()
		{
			((GrabbableObject)this).OnHitGround();
			if (!((NetworkBehaviour)this).IsHost || isJumping || base.isInElevator)
			{
				return;
			}
			if (wasObjectPlaced)
			{
				wasObjectPlaced = false;
				return;
			}
			int num = SetJumpCount();
			if (num > 0)
			{
				((MonoBehaviour)this).StartCoroutine(IDoJumpingCoroutine(num));
			}
		}

		public override void OnPlaceObject()
		{
			((GrabbableObject)this).OnPlaceObject();
			wasObjectPlaced = true;
		}

		public override void FallWithCurve()
		{
			//IL_000c: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			if (isJumping)
			{
				Vector3 val = base.targetFloorPosition - base.startFallingPosition;
				float magnitude = ((Vector3)(ref val)).magnitude;
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(base.itemProperties.restingRotation.x, Mathf.Atan2(base.targetFloorPosition.x - base.startFallingPosition.x, base.targetFloorPosition.z - base.startFallingPosition.z) * 57.29578f + 90f, base.itemProperties.restingRotation.z), 16f * Time.deltaTime / magnitude);
				((Component)this).transform.localPosition = Vector3.Lerp(base.startFallingPosition, base.targetFloorPosition, base.fallTime);
				Transform transform = ((Component)this).transform;
				transform.localPosition += Vector3.up * (JumpCurve.Evaluate(base.fallTime) * jumpHeight);
				base.fallTime += Mathf.Abs(Time.deltaTime * 12f / magnitude);
				if (base.fallTime >= 1f)
				{
					base.reachedFloorTarget = true;
					((GrabbableObject)this).OnHitGround();
				}
			}
			else
			{
				((GrabbableObject)this).FallWithCurve();
			}
		}

		private int SetJumpCount()
		{
			if (Random.Range(0, 100) < jumpChance)
			{
				return Random.RandomRangeInt(jumpCountMin, jumpCountMax + 1);
			}
			return 0;
		}

		[IteratorStateMachine(typeof(<IDoJumpingCoroutine>d__32))]
		private IEnumerator IDoJumpingCoroutine(int counter)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <IDoJumpingCoroutine>d__32(0)
			{
				<>4__this = this,
				counter = counter
			};
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void StartRPC()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0064: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(146954598u, val2, val, (SendTo)7, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 146954598u, val2, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				isJumping = true;
				Animator obj = animator;
				if (obj != null)
				{
					obj.SetBool("Winding", true);
				}
				AudioSource obj2 = audioSource;
				if (obj2 != null)
				{
					obj2.Play();
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void StopRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0064: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1152892137u, val2, val, (SendTo)7, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 1152892137u, val2, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				isJumping = false;
				failsafeCount = 0;
				Animator obj = animator;
				if (obj != null)
				{
					obj.SetBool("Winding", false);
				}
				AudioSource obj2 = audioSource;
				if (obj2 != null)
				{
					obj2.Stop();
				}
			}
		}

		public Vector3 GetJumpTarget()
		{
			//IL_0007: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			soccerRay = new Ray(((Component)this).transform.position, GetJumpDirection());
			float num = ((!Physics.Raycast(soccerRay, ref soccerHit, jumpDistance + wallAvoidance, LayerMask.op_Implicit(hitMask), (QueryTriggerInteraction)1)) ? jumpDistance : Mathf.Max(((RaycastHit)(ref soccerHit)).distance - ((((Component)((RaycastHit)(ref soccerHit)).collider).gameObject.tag == "Rock") ? (wallAvoidance * 3f) : wallAvoidance), 0f));
			if (Physics.Raycast(((Ray)(ref soccerRay)).GetPoint(num), Vector3.down, ref soccerHit, 65f, LayerMask.op_Implicit(hitMask), (QueryTriggerInteraction)1) && IsLandingPositionValid())
			{
				return ((RaycastHit)(ref soccerHit)).point;
			}
			if (Physics.Raycast(((Ray)(ref soccerRay)).GetPoint(num - 0.15f), Vector3.down, ref soccerHit, 65f, LayerMask.op_Implicit(hitMask), (QueryTriggerInteraction)1) && IsLandingPositionValid())
			{
				return ((RaycastHit)(ref soccerHit)).point;
			}
			return Vector3.zero;
		}

		public Vector3 GetJumpDirection()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Vector2 insideUnitCircle = Random.insideUnitCircle;
			Vector3 val = Vector2.op_Implicit(((Vector2)(ref insideUnitCircle)).normalized);
			val.z = val.y;
			val.y = upwardClearance;
			return val;
		}

		public bool IsLandingPositionValid()
		{
			//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)
			if (((RaycastHit)(ref soccerHit)).distance > maxFallHeight)
			{
				return false;
			}
			if (Vector3.Angle(((RaycastHit)(ref soccerHit)).normal, Vector3.up) >= (float)slopeLimit)
			{
				return false;
			}
			return true;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void FrogJumpRPC(Vector3 destinationPos, bool setInElevator, bool setInShipRoom)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: 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_018f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1675992513u, val2, val, (SendTo)7, (RpcDelivery)0);
				((FastBufferWriter)(ref val3)).WriteValueSafe(ref destinationPos);
				((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref setInElevator, default(ForPrimitives));
				((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref setInShipRoom, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val3, 1675992513u, val2, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				Animator obj = animator;
				if (obj != null)
				{
					obj.SetTrigger("Hop");
				}
				base.fallTime = 0f;
				base.hasHitGround = false;
				if (setInElevator)
				{
					((Component)this).transform.SetParent(StartOfRound.Instance.elevatorTransform, true);
				}
				else
				{
					((Component)this).transform.SetParent(StartOfRound.Instance.propsContainer, true);
				}
				GameNetworkManager.Instance.localPlayerController.SetItemInElevator(setInElevator, setInShipRoom, (GrabbableObject)(object)this);
				base.startFallingPosition = ((Component)this).transform.parent.InverseTransformPoint(((Component)this).transform.position + Vector3.up * 0.07f);
				base.targetFloorPosition = destinationPos;
			}
		}

		private void JumpEvent()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			AudioSource obj = audioSource;
			if (obj != null)
			{
				obj.PlayOneShot(jumpSound);
			}
			if (Vector3.Distance(lastPositionAtFart, ((Component)this).transform.position) > 2f)
			{
				timesPlayedInOneSpot = 0;
			}
			timesPlayedInOneSpot++;
			lastPositionAtFart = ((Component)this).transform.position;
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange / 2f, noiseLoudness / 2f, timesPlayedInOneSpot, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(146954598u, new RpcReceiveHandler(__rpc_handler_146954598), "StartRPC");
			((NetworkBehaviour)this).__registerRpc(1152892137u, new RpcReceiveHandler(__rpc_handler_1152892137), "StopRpc");
			((NetworkBehaviour)this).__registerRpc(1675992513u, new RpcReceiveHandler(__rpc_handler_1675992513), "FrogJumpRPC");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_146954598(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HoppingScrap)(object)target).StartRPC();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1152892137(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HoppingScrap)(object)target).StopRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1675992513(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_003c: 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_0057: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 destinationPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref destinationPos);
				bool setInElevator = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setInElevator, default(ForPrimitives));
				bool setInShipRoom = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setInShipRoom, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HoppingScrap)(object)target).FrogJumpRPC(destinationPos, setInElevator, setInShipRoom);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "HoppingScrap";
		}
	}
	internal class MetronomeScrap : GrabbableObject
	{
		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			((GrabbableObject)this).__initializeRpcs();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "MetronomeScrap";
		}
	}
	internal class SlinkyScrap : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <ISlinking>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public SlinkyScrap <>4__this;

			private bool <onUnstableGround>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ISlinking>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				SlinkyScrap slinkyScrap = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					RaycastHit val = default(RaycastHit);
					Physics.Raycast(((GrabbableObject)slinkyScrap).targetFloorPosition, -Vector3.up, ref val, 0.1f, 268437761, (QueryTriggerInteraction)1);
					<onUnstableGround>5__2 = slinkyScrap.OnStableGround(((RaycastHit)(ref val)).normal);
					break;
				}
				case 1:
					<>1__state = -1;
					break;
				}
				if (((GrabbableObject)slinkyScrap).fallTime < 1f)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				while (<onUnstableGround>5__2)
				{
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public int stableAngle = 40;

		public float horizontalSearchDistance = 1f;

		public float dropDistance = 1f;

		public override void OnHitGround()
		{
			if (((NetworkBehaviour)this).IsHost)
			{
				((MonoBehaviour)this).StartCoroutine(ISlinking());
			}
		}

		[IteratorStateMachine(typeof(<ISlinking>d__4))]
		private IEnumerator ISlinking()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ISlinking>d__4(0)
			{
				<>4__this = this
			};
		}

		private bool OnStableGround(Vector3 hitNormal)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)Vector3.Angle(hitNormal, Vector3.up));
			if (Vector3.Angle(hitNormal, Vector3.up) > (float)stableAngle)
			{
				return true;
			}
			return false;
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			((GrabbableObject)this).__initializeRpcs();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SlinkyScrap";
		}
	}
	internal class VolatileScrap : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <DetonateAfterDelay>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public VolatileScrap <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DetonateAfterDelay>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Expected O, but got Unknown
				int num = <>1__state;
				VolatileScrap volatileScrap = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					volatileScrap.hasExploded = true;
					<>2__current = (object)new WaitForSeconds(0.4f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					volatileScrap.DetonateRpc();
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public bool explosionsEnabled;

		private bool hasExploded;

		public AudioClip explosionSFX;

		public virtual void OnHitWithExplosion()
		{
			if (((NetworkBehaviour)this).IsServer && explosionsEnabled)
			{
				StartDetonateRpc();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void StartDetonateRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0064: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1306458307u, val2, val, (SendTo)2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 1306458307u, val2, val, (SendTo)2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (!hasExploded)
				{
					hasExploded = true;
					((MonoBehaviour)this).StartCoroutine(DetonateAfterDelay());
				}
			}
		}

		[IteratorStateMachine(typeof(<DetonateAfterDelay>d__5))]
		private IEnumerator DetonateAfterDelay()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DetonateAfterDelay>d__5(0)
			{
				<>4__this = this
			};
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void DetonateRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0064: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2010984667u, val2, val, (SendTo)7, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 2010984667u, val2, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					AudioSource component = ((Component)this).gameObject.GetComponent<AudioSource>();
					component.PlayOneShot(explosionSFX);
					WalkieTalkie.TransmitOneShotAudio(component, explosionSFX, 1f);
					Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up * 0.2f, true, 0f, 1f, 50, 0f, (GameObject)null, false);
					((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
				}
			}
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1306458307u, new RpcReceiveHandler(__rpc_handler_1306458307), "StartDetonateRpc");
			((NetworkBehaviour)this).__registerRpc(2010984667u, new RpcReceiveHandler(__rpc_handler_2010984667), "DetonateRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_1306458307(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((VolatileScrap)(object)target).StartDetonateRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2010984667(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((VolatileScrap)(object)target).DetonateRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "VolatileScrap";
		}
	}
	internal static class ExplosiveScrap
	{
		internal static Harmony? Harmony { get; set; }

		public static void PatchLandmines()
		{
			//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_0017: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("VolatileLandminePatch");
			}
			Harmony.PatchAll(typeof(VolatileLandminePatch));
		}
	}
	internal class VolatileLandminePatch
	{
		[HarmonyPatch(typeof(Landmine), "SpawnExplosion")]
		[HarmonyPostfix]
		private static void SpawnExplosion(Vector3 explosionPosition, float damageRange)
		{
			//IL_0000: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapSphere(explosionPosition, damageRange, 64);
			RaycastHit val = default(RaycastHit);
			for (int i = 0; i < array.Length; i++)
			{
				VolatileScrap component = ((Component)array[i]).GetComponent<VolatileScrap>();
				if ((Object)(object)component != (Object)null)
				{
					float num = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position);
					if (!Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, ref val, 1073742080, (QueryTriggerInteraction)1) || (((Component)((RaycastHit)(ref val)).collider).gameObject.layer != 30 && !(num > 4f)))
					{
						component?.OnHitWithExplosion();
					}
				}
			}
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace GlitchyScrap.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}