Decompiled source of Glitchy Scrap v1.0.7

plugins/GlitchyScrap.dll

Decompiled 6 days 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.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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GlitchyScrap")]
[assembly: AssemblyConfiguration("Debug")]
[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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: 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, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> 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.6")]
	[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.src.Behaviours
{
	internal class SlinkyScrap : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <ISlinking>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Vector3 initialDirection;

			public SlinkyScrap <>4__this;

			private bool <leadingEnd>5__1;

			private bool <sfxPlayedThisStep>5__2;

			private Vector3 <previousPosition>5__3;

			private Vector3 <anchorPos>5__4;

			private Vector3 <nextPosition>5__5;

			private Vector3 <axis>5__6;

			private float <t>5__7;

			private int <i>5__8;

			private float <b>5__9;

			private int <i>5__10;

			private float <b>5__11;

			private int <i>5__12;

			private float <b>5__13;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//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_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: 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)
				//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_07d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: Unknown result type (might be due to invalid IL or missing references)
				//IL_012a: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: 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_03e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_040b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0410: Unknown result type (might be due to invalid IL or missing references)
				//IL_0415: Unknown result type (might be due to invalid IL or missing references)
				//IL_041c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0422: Unknown result type (might be due to invalid IL or missing references)
				//IL_0427: Unknown result type (might be due to invalid IL or missing references)
				//IL_042c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0431: Unknown result type (might be due to invalid IL or missing references)
				//IL_0436: Unknown result type (might be due to invalid IL or missing references)
				//IL_043a: Unknown result type (might be due to invalid IL or missing references)
				//IL_043f: Unknown result type (might be due to invalid IL or missing references)
				//IL_07e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_07eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_07f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0804: Unknown result type (might be due to invalid IL or missing references)
				//IL_0809: Unknown result type (might be due to invalid IL or missing references)
				//IL_080e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0813: Unknown result type (might be due to invalid IL or missing references)
				//IL_0818: Unknown result type (might be due to invalid IL or missing references)
				//IL_081c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0821: Unknown result type (might be due to invalid IL or missing references)
				//IL_0487: Unknown result type (might be due to invalid IL or missing references)
				//IL_048d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0492: Unknown result type (might be due to invalid IL or missing references)
				//IL_049c: Unknown result type (might be due to invalid IL or missing references)
				//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0878: Unknown result type (might be due to invalid IL or missing references)
				//IL_087e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0883: Unknown result type (might be due to invalid IL or missing references)
				//IL_088d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0893: Unknown result type (might be due to invalid IL or missing references)
				//IL_0898: Unknown result type (might be due to invalid IL or missing references)
				//IL_08a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_08a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_08b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0174: 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_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_0194: Unknown result type (might be due to invalid IL or missing references)
				//IL_0199: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_0512: Unknown result type (might be due to invalid IL or missing references)
				//IL_0517: Unknown result type (might be due to invalid IL or missing references)
				//IL_08fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_020d: Unknown result type (might be due to invalid IL or missing references)
				//IL_022c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: Unknown result type (might be due to invalid IL or missing references)
				//IL_0237: Unknown result type (might be due to invalid IL or missing references)
				//IL_0248: Unknown result type (might be due to invalid IL or missing references)
				//IL_024e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0259: Unknown result type (might be due to invalid IL or missing references)
				//IL_025e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0263: Unknown result type (might be due to invalid IL or missing references)
				//IL_0284: Unknown result type (might be due to invalid IL or missing references)
				//IL_028e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0293: Unknown result type (might be due to invalid IL or missing references)
				//IL_029e: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0561: Unknown result type (might be due to invalid IL or missing references)
				//IL_091d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0923: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0582: Unknown result type (might be due to invalid IL or missing references)
				//IL_0588: Unknown result type (might be due to invalid IL or missing references)
				//IL_0944: Unknown result type (might be due to invalid IL or missing references)
				//IL_0949: Unknown result type (might be due to invalid IL or missing references)
				//IL_094f: Unknown result type (might be due to invalid IL or missing references)
				//IL_095a: Unknown result type (might be due to invalid IL or missing references)
				//IL_095f: Unknown result type (might be due to invalid IL or missing references)
				//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_05db: Unknown result type (might be due to invalid IL or missing references)
				//IL_09e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_09e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0601: Unknown result type (might be due to invalid IL or missing references)
				//IL_060c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0611: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a21: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a26: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a64: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a4e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a69: Unknown result type (might be due to invalid IL or missing references)
				//IL_068a: Unknown result type (might be due to invalid IL or missing references)
				//IL_068f: Unknown result type (might be due to invalid IL or missing references)
				//IL_06c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_06cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_070a: Unknown result type (might be due to invalid IL or missing references)
				//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_070f: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val;
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_005b;
				case 1:
					<>1__state = -1;
					goto IL_005b;
				case 2:
					<>1__state = -1;
					goto IL_039d;
				case 3:
					<>1__state = -1;
					goto IL_07ae;
				case 4:
					{
						<>1__state = -1;
						break;
					}
					IL_005b:
					if (!((GrabbableObject)<>4__this).reachedFloorTarget)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					if ((Object)(object)((Component)<>4__this).transform.parent == (Object)null)
					{
						return false;
					}
					<leadingEnd>5__1 = true;
					<sfxPlayedThisStep>5__2 = false;
					<previousPosition>5__3 = ((Component)<>4__this).transform.parent.TransformPoint(((GrabbableObject)<>4__this).targetFloorPosition);
					<>4__this.nextPoint = <previousPosition>5__3;
					<anchorPos>5__4 = <previousPosition>5__3;
					<nextPosition>5__5 = <>4__this.GetNextPosition(initialDirection);
					if (<>4__this.nextPoint == Vector3.zero)
					{
						return false;
					}
					val = Vector3.Cross(<nextPosition>5__5 - <previousPosition>5__3, Vector3.up);
					<axis>5__6 = ((Vector3)(ref val)).normalized;
					<t>5__7 = 0f;
					goto IL_039d;
					IL_07ae:
					if (<t>5__7 < 1f)
					{
						if (((GrabbableObject)<>4__this).isHeld || ((GrabbableObject)<>4__this).isHeldByEnemy)
						{
							return false;
						}
						<>4__this.SyncRootPositionRpc(Vector3.Lerp((<previousPosition>5__3 + <anchorPos>5__4) / 2f, (<nextPosition>5__5 + <anchorPos>5__4) / 2f, <t>5__7) + Vector3.up * Mathf.Lerp(<>4__this.curve.Evaluate(0.5f) * 0.2f, 0.5f, (<t>5__7 < 0.5f) ? <t>5__7 : (1f - <t>5__7)));
						<i>5__10 = 0;
						while (<i>5__10 < <>4__this.bones.Length)
						{
							<b>5__11 = (float)<i>5__10 / ((float)<>4__this.bones.Count() - 1f);
							<>4__this.SyncBonePositionRpc(<i>5__10, Vector3.Lerp(<previousPosition>5__3 * (<leadingEnd>5__1 ? (1f - <b>5__11) : <b>5__11) + <anchorPos>5__4 * (<leadingEnd>5__1 ? <b>5__11 : (1f - <b>5__11)), <nextPosition>5__5 * (<leadingEnd>5__1 ? (1f - <b>5__11) : <b>5__11) + <anchorPos>5__4 * (<leadingEnd>5__1 ? <b>5__11 : (1f - <b>5__11)), <t>5__7) + Vector3.up * Mathf.Lerp(<>4__this.curve.Evaluate(<leadingEnd>5__1 ? (1f - <b>5__11) : <b>5__11) * 0.2f, <leadingEnd>5__1 ? (1f - <b>5__11) : <b>5__11, (<t>5__7 < 0.5f) ? <t>5__7 : (1f - <t>5__7)), Quaternion.AngleAxis((<leadingEnd>5__1 ? (1f - <b>5__11) : <b>5__11) * Mathf.Lerp(180f, -180f, <t>5__7), <axis>5__6) * (((<leadingEnd>5__1 ? (1f - <b>5__11) : <b>5__11) > 0.5f) ? Quaternion.Euler(0f, 0f, 180f) : Quaternion.identity));
							<i>5__10++;
						}
						if (!<sfxPlayedThisStep>5__2 && <t>5__7 > 0.5f)
						{
							<>4__this.SpringSoundRpc();
							<sfxPlayedThisStep>5__2 = true;
						}
						<t>5__7 += Time.deltaTime * 1.5f;
						<>2__current = null;
						<>1__state = 3;
						return true;
					}
					goto IL_07c5;
					IL_039d:
					if (<t>5__7 < 1f && !((GrabbableObject)<>4__this).isHeld && !((GrabbableObject)<>4__this).isHeldByEnemy)
					{
						if (((GrabbableObject)<>4__this).isHeld || ((GrabbableObject)<>4__this).isHeldByEnemy)
						{
							return false;
						}
						<>4__this.SyncRootPositionRpc(Vector3.Lerp(<previousPosition>5__3 + Vector3.up * 0.2f, (<nextPosition>5__5 + <previousPosition>5__3) / 2f, <t>5__7));
						<i>5__8 = 0;
						while (<i>5__8 < <>4__this.bones.Length)
						{
							<b>5__9 = (float)<i>5__8 / ((float)<>4__this.bones.Count() - 1f);
							<>4__this.SyncBonePositionRpc(<i>5__8, Vector3.Lerp(<previousPosition>5__3 + Vector3.up * <>4__this.restingStateBoneSpacing * (float)(<>4__this.bones.Count() - 1 - <i>5__8), <nextPosition>5__5 * (1f - <b>5__9) + <previousPosition>5__3 * <b>5__9 + Vector3.up * <>4__this.curve.Evaluate(1f - <b>5__9) * 0.2f, <t>5__7), Quaternion.AngleAxis((1f - <b>5__9) * Mathf.Lerp(0f, -180f, <t>5__7), <axis>5__6) * ((1f - <b>5__9 > 0.5f) ? Quaternion.Euler(0f, 0f, 180f) : Quaternion.identity));
							<i>5__8++;
						}
						if (!<sfxPlayedThisStep>5__2 && <t>5__7 > 0.5f)
						{
							<>4__this.SpringSoundRpc();
							<sfxPlayedThisStep>5__2 = true;
						}
						<t>5__7 += Time.deltaTime * 3f;
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					goto IL_07c5;
					IL_07c5:
					if (<>4__this.OnUnstableGround(<>4__this.nextNormal))
					{
						<leadingEnd>5__1 = !<leadingEnd>5__1;
						<previousPosition>5__3 = <anchorPos>5__4;
						<anchorPos>5__4 = <nextPosition>5__5;
						<nextPosition>5__5 = <>4__this.GetNextPosition(<>4__this.nextNormal);
						val = Vector3.Cross(<nextPosition>5__5 - <previousPosition>5__3, Vector3.up);
						<axis>5__6 = ((Vector3)(ref val)).normalized;
						<sfxPlayedThisStep>5__2 = false;
						<t>5__7 = 0f;
						goto IL_07ae;
					}
					<previousPosition>5__3 = <anchorPos>5__4;
					<anchorPos>5__4 = <nextPosition>5__5;
					val = Vector3.Cross(<anchorPos>5__4 - <previousPosition>5__3, Vector3.up);
					<axis>5__6 = ((Vector3)(ref val)).normalized;
					<leadingEnd>5__1 = !<leadingEnd>5__1;
					<sfxPlayedThisStep>5__2 = false;
					<t>5__7 = 0f;
					break;
				}
				if (<t>5__7 < 1f)
				{
					if (((GrabbableObject)<>4__this).isHeld || ((GrabbableObject)<>4__this).isHeldByEnemy)
					{
						return false;
					}
					<>4__this.SyncRootPositionRpc(Vector3.Lerp((<previousPosition>5__3 + <anchorPos>5__4) / 2f, <nextPosition>5__5 + Vector3.up * 0.2f, <t>5__7));
					<i>5__12 = 0;
					while (<i>5__12 < <>4__this.bones.Length)
					{
						<b>5__13 = (float)<i>5__12 / ((float)<>4__this.bones.Count() - 1f);
						<>4__this.SyncBonePositionRpc(<i>5__12, Vector3.Lerp(<previousPosition>5__3 * (<leadingEnd>5__1 ? (1f - <b>5__13) : <b>5__13) + <anchorPos>5__4 * (<leadingEnd>5__1 ? <b>5__13 : (1f - <b>5__13)), <nextPosition>5__5, <t>5__7) + Vector3.up * Mathf.Lerp(<>4__this.curve.Evaluate(<leadingEnd>5__1 ? (1f - <b>5__13) : <b>5__13) * 0.2f, <leadingEnd>5__1 ? (<>4__this.restingStateBoneSpacing * (float)(<>4__this.bones.Count() - 1 - <i>5__12)) : (<>4__this.restingStateBoneSpacing * (float)<i>5__12), <t>5__7), Quaternion.AngleAxis((<leadingEnd>5__1 ? (1f - <b>5__13) : <b>5__13) * Mathf.Lerp(180f, 0f, <t>5__7), <axis>5__6) * (((<leadingEnd>5__1 ? (1f - <b>5__13) : <b>5__13) > 0.5f) ? Quaternion.Euler(0f, 0f, 180f) : Quaternion.identity));
						<i>5__12++;
					}
					if (!<sfxPlayedThisStep>5__2 && <t>5__7 > 0.5f)
					{
						<>4__this.SpringSoundRpc();
						<sfxPlayedThisStep>5__2 = true;
					}
					<t>5__7 += Time.deltaTime * 3f;
					<>2__current = null;
					<>1__state = 4;
					return true;
				}
				<>4__this.SpringSoundRpc();
				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 = 30;

		public float horizontalSearchDistance = 0.75f;

		public float dropDistance = 1f;

		public Transform[] bones;

		public AnimationCurve curve;

		public Vector3 nextPoint;

		public Vector3 nextNormal;

		public AudioClip? sproing;

		private float restingStateBoneSpacing = 0.04f;

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			ResetPositionRpc();
		}

		public override void GrabItemFromEnemy(EnemyAI enemy)
		{
			((GrabbableObject)this).GrabItemFromEnemy(enemy);
			ResetPositionRpc();
		}

		private void ResetPositionRpc()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			for (int i = 0; i < bones.Length; i++)
			{
				bones[i].localPosition = Vector3.up * (0.1f - restingStateBoneSpacing * (float)i);
				bones[i].localRotation = ((i < bones.Count() / 2) ? Quaternion.Euler(0f, 0f, 180f) : Quaternion.identity);
			}
		}

		public override void OnHitGround()
		{
			//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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)this).IsHost)
			{
				RaycastHit val = default(RaycastHit);
				Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, 0.2f, 268437761, (QueryTriggerInteraction)1);
				if (OnUnstableGround(((RaycastHit)(ref val)).normal))
				{
					((MonoBehaviour)this).StartCoroutine(ISlinking(((RaycastHit)(ref val)).normal));
				}
			}
		}

		[IteratorStateMachine(typeof(<ISlinking>d__13))]
		private IEnumerator ISlinking(Vector3 initialDirection)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ISlinking>d__13(0)
			{
				<>4__this = this,
				initialDirection = initialDirection
			};
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void SpringSoundRpc()
		{
			//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)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3438891213u, val2, val, (SendTo)7, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 3438891213u, val2, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((Component)this).gameObject.GetComponent<AudioSource>().PlayOneShot(sproing);
				}
			}
		}

		private bool OnUnstableGround(Vector3 hitNormal)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			if (Vector3.Angle(hitNormal, Vector3.up) > (float)stableAngle)
			{
				return true;
			}
			return false;
		}

		private Vector3 GetNextPosition(Vector3 direction)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0070: Unknown result type (might be due to invalid IL or missing references)
			direction.y = 0f;
			Vector3 val = nextPoint + direction * horizontalSearchDistance;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, Vector3.down, ref val2, dropDistance, 268437761, (QueryTriggerInteraction)1))
			{
				nextPoint = ((RaycastHit)(ref val2)).point;
				nextNormal = ((RaycastHit)(ref val2)).normal;
				return ((RaycastHit)(ref val2)).point;
			}
			return Vector3.zero;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void SyncRootPositionRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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(2054743686u, val2, val, (SendTo)7, (RpcDelivery)0);
					((FastBufferWriter)(ref val3)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 2054743686u, val2, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((Component)this).transform.position = position;
					base.targetFloorPosition = ((Component)this).transform.parent.InverseTransformPoint(((Component)this).transform.position);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void SyncBonePositionRpc(int bone, Vector3 position, Quaternion rotation)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00db: 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(3839355590u, val2, val, (SendTo)7, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val3, bone);
					((FastBufferWriter)(ref val3)).WriteValueSafe(ref position);
					((FastBufferWriter)(ref val3)).WriteValueSafe(ref rotation);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 3839355590u, val2, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					bones[bone].SetPositionAndRotation(position, rotation);
				}
			}
		}

		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(3438891213u, new RpcReceiveHandler(__rpc_handler_3438891213), "SpringSoundRpc");
			((NetworkBehaviour)this).__registerRpc(2054743686u, new RpcReceiveHandler(__rpc_handler_2054743686), "SyncRootPositionRpc");
			((NetworkBehaviour)this).__registerRpc(3839355590u, new RpcReceiveHandler(__rpc_handler_3839355590), "SyncBonePositionRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_3438891213(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;
				((SlinkyScrap)(object)target).SpringSoundRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2054743686(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SlinkyScrap)(object)target).SyncRootPositionRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3839355590(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int bone = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref bone);
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				Quaternion rotation = default(Quaternion);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SlinkyScrap)(object)target).SyncBonePositionRpc(bone, position, rotation);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SlinkyScrap";
		}
	}
}
namespace GlitchyScrap.Behaviours
{
	internal class BallButWithActualRotation : SoccerBallProp
	{
		public override void Update()
		{
			//IL_00fb: 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_0087: 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_0002: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: 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_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00d0: 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 int counter;

			public HoppingScrap <>4__this;

			private Vector3 <jumpTarget>5__1;

			private bool <setInShipRoom>5__2;

			private bool <setInElevator>5__3;

			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_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0130: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_013a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0155: Unknown result type (might be due to invalid IL or missing references)
				//IL_015a: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: 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_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_0058;
				case 1:
					<>1__state = -1;
					goto IL_0058;
				case 2:
					<>1__state = -1;
					<jumpTarget>5__1 = <>4__this.GetJumpTarget();
					if (<jumpTarget>5__1 != Vector3.zero)
					{
						<setInShipRoom>5__2 = false;
						Bounds bounds = StartOfRound.Instance.shipBounds.bounds;
						if (!((Bounds)(ref bounds)).Contains(<jumpTarget>5__1))
						{
							<setInElevator>5__3 = false;
							<jumpTarget>5__1 = StartOfRound.Instance.propsContainer.InverseTransformPoint(<jumpTarget>5__1);
						}
						else
						{
							<setInElevator>5__3 = true;
							bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds;
							<setInShipRoom>5__2 = ((Bounds)(ref bounds)).Contains(<jumpTarget>5__1);
							<jumpTarget>5__1 = StartOfRound.Instance.elevatorTransform.InverseTransformPoint(<jumpTarget>5__1);
						}
						counter--;
						<>4__this.failsafeCount = 0;
						<>4__this.FrogJumpRPC(<jumpTarget>5__1, <setInElevator>5__3, <setInShipRoom>5__2);
						goto IL_01bc;
					}
					<>4__this.failsafeCount++;
					goto IL_01f2;
				case 3:
					<>1__state = -1;
					goto IL_01bc;
				case 4:
					{
						<>1__state = -1;
						<>4__this.StopRpc();
						return false;
					}
					IL_0058:
					if (!((GrabbableObject)<>4__this).reachedFloorTarget)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<>4__this.StartRPC();
					goto IL_01f2;
					IL_01bc:
					if (((GrabbableObject)<>4__this).fallTime < 1f)
					{
						<>2__current = null;
						<>1__state = 3;
						return true;
					}
					goto IL_01f2;
					IL_01f2:
					if (counter > 0 && <>4__this.failsafeCount < 5 && !((GrabbableObject)<>4__this).isInElevator)
					{
						<>2__current = (object)new WaitForSeconds(<>4__this.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_0010: 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)
			//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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			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_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: 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_0189: 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_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_006d: 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 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_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.hasExploded = true;
					<>2__current = (object)new WaitForSeconds(0.4f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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_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_0018: 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_0001: 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_0034: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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)
			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
	{
	}
}