Decompiled source of Glitchy Scrap v1.1.3

plugins/GlitchyScrap.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Dawn.Utils;
using Dusk;
using GameNetcodeStuff;
using GlitchyScrap.NetcodePatcher;
using GlitchyScrap.src;
using GlitchyScrap.src.Behaviours;
using GlitchyScrap.src.Patches;
using GlitchyScrap.src.Shared;
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.9.0")]
[assembly: AssemblyInformationalVersion("1.0.9")]
[assembly: AssemblyProduct("GlitchyScrap")]
[assembly: AssemblyTitle("GlitchyScrap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.9.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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.9";
	}
}
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 : ExtendedGrabbableObject
	{
		[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 RaycastHit soccerHit;

		private bool isJumping;

		private bool wasObjectPlaced;

		private const int maxFailCount = 5;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			if (((NetworkBehaviour)this).IsServer)
			{
				WindUpFrog windUpFrog = ContentHandler<GsContentHandler>.Instance.windUpFrog;
				if (windUpFrog != null)
				{
					jumpChance = ((AssetBundleLoader<WindUpFrog>)(object)windUpFrog).GetConfig<int>("Jump Chance").Value;
					jumpCountMin = (int)((AssetBundleLoader<WindUpFrog>)(object)windUpFrog).GetConfig<BoundedRange>("Jump Count").Value.Min;
					jumpCountMax = (int)((AssetBundleLoader<WindUpFrog>)(object)windUpFrog).GetConfig<BoundedRange>("Jump Count").Value.Max + 1;
				}
			}
			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();
			isJumping = false;
		}

		public override void GrabItemFromEnemy(EnemyAI enemy)
		{
			((GrabbableObject)this).GrabItemFromEnemy(enemy);
			isJumping = false;
		}

		public override void OnHitGround()
		{
			((GrabbableObject)this).OnHitGround();
			if (!((NetworkBehaviour)this).IsHost || isJumping || ((GrabbableObject)this).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 = ((GrabbableObject)this).targetFloorPosition - ((GrabbableObject)this).startFallingPosition;
				float magnitude = ((Vector3)(ref val)).magnitude;
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(((GrabbableObject)this).itemProperties.restingRotation.x, Mathf.Atan2(((GrabbableObject)this).targetFloorPosition.x - ((GrabbableObject)this).startFallingPosition.x, ((GrabbableObject)this).targetFloorPosition.z - ((GrabbableObject)this).startFallingPosition.z) * 57.29578f + 90f, ((GrabbableObject)this).itemProperties.restingRotation.z), 16f * Time.deltaTime / magnitude);
				((Component)this).transform.localPosition = Vector3.Lerp(((GrabbableObject)this).startFallingPosition, ((GrabbableObject)this).targetFloorPosition, ((GrabbableObject)this).fallTime);
				Transform transform = ((Component)this).transform;
				transform.localPosition += Vector3.up * (JumpCurve.Evaluate(((GrabbableObject)this).fallTime) * jumpHeight);
				((GrabbableObject)this).fallTime = ((GrabbableObject)this).fallTime + Mathf.Abs(Time.deltaTime * 12f / magnitude);
				if (((GrabbableObject)this).fallTime >= 1f)
				{
					((GrabbableObject)this).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;
		}

		private IEnumerator IDoJumpingCoroutine(int counter)
		{
			yield return (object)new WaitUntil((Func<bool>)(() => ((GrabbableObject)this).reachedFloorTarget));
			int failsafeCount = 0;
			StartRPC();
			while (counter > 0 && failsafeCount < 5 && !((GrabbableObject)this).isInElevator && isJumping)
			{
				yield return (object)new WaitForSeconds(jumpDelay);
				Vector3 jumpTarget = 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--;
					failsafeCount = 0;
					FrogJumpRPC(jumpTarget, setInElevator, setInShipRoom);
					while (!((GrabbableObject)this).reachedFloorTarget && isJumping)
					{
						yield return null;
					}
				}
				else
				{
					failsafeCount++;
				}
			}
			StopRpc();
		}

		[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 val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(146954598u, val3, val, (SendTo)7, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 146954598u, val3, 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 val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1152892137u, val3, val, (SendTo)7, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1152892137u, val3, 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.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_0018: 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)
			//IL_0097: 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_00ad: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(((Component)this).transform.position, GetJumpDirection());
			float num = ((!Physics.Raycast(val, 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 val)).GetPoint(num), Vector3.down, ref soccerHit, 65f, LayerMask.op_Implicit(hitMask), (QueryTriggerInteraction)1) && IsLandingPositionValid())
			{
				return ((RaycastHit)(ref soccerHit)).point;
			}
			if (Physics.Raycast(((Ray)(ref val)).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;
			}
			if (((Object)((RaycastHit)(ref soccerHit)).collider).name == "OutOfBoundsTerrain")
			{
				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 val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1675992513u, val3, val, (SendTo)7, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref destinationPos);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setInElevator, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setInShipRoom, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1675992513u, val3, 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");
				}
				((GrabbableObject)this).fallTime = 0f;
				((GrabbableObject)this).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);
				((GrabbableObject)this).startFallingPosition = ((Component)this).transform.parent.InverseTransformPoint(((Component)this).transform.position + Vector3.up * 0.07f);
				((GrabbableObject)this).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, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
		}

		protected override void __initializeVariables()
		{
			base.__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");
			base.__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, IExplosionInteraction
	{
		public bool explosionsEnabled = true;

		private bool hasExploded;

		public AudioClip explosionSFX;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			if (((NetworkBehaviour)this).IsServer)
			{
				Dynamite dynamite = ContentHandler<GsContentHandler>.Instance.dynamite;
				if (dynamite != null)
				{
					explosionsEnabled = ((AssetBundleLoader<Dynamite>)(object)dynamite).GetConfig<bool>("Explosive").Value;
				}
			}
		}

		public void HitByExplosion(bool v)
		{
			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 val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1306458307u, val3, val, (SendTo)2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1306458307u, val3, 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());
				}
			}
		}

		private IEnumerator DetonateAfterDelay()
		{
			hasExploded = true;
			yield return (object)new WaitForSeconds(0.4f);
			DetonateRpc();
		}

		[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 val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2010984667u, val3, val, (SendTo)7, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 2010984667u, val3, 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";
		}
	}
}
namespace GlitchyScrap.src
{
	internal class GsContentHandler : ContentHandler<GsContentHandler>
	{
		public WindUpFrog? windUpFrog;

		public Dynamite? dynamite;

		public GsContentHandler(DuskMod mod)
			: base(mod)
		{
			DefaultBundle val = default(DefaultBundle);
			foreach (AssetBundleData assetBundle in mod.Content.assetBundles)
			{
				string assetBundleName = assetBundle.assetBundleName;
				if (!(assetBundleName == "frogeassets"))
				{
					if (assetBundleName == "dynamiteassets")
					{
						((ContentHandler)this).RegisterContent<Dynamite>(assetBundle.assetBundleName, ref dynamite, false);
					}
					else
					{
						((ContentHandler)this).RegisterContent<DefaultBundle>(assetBundle.assetBundleName, ref val, false);
					}
				}
				else
				{
					((ContentHandler)this).RegisterContent<WindUpFrog>(assetBundle.assetBundleName, ref windUpFrog, false);
				}
			}
		}
	}
	public class WindUpFrog : AssetBundleLoader<WindUpFrog>
	{
		public WindUpFrog(DuskMod mod, string filePath)
			: base(mod, filePath)
		{
		}
	}
	public class Dynamite : AssetBundleLoader<Dynamite>
	{
		public Dynamite(DuskMod mod, string filePath)
			: base(mod, filePath)
		{
		}
	}
	[BepInPlugin("GlitchyScrap", "GlitchyScrap", "1.1.3")]
	[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();
			LightningStrikePatch.PatchLightning();
			DamageDetectionPatch.PatchPlayer();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin GlitchyScrap is loaded!");
		}
	}
}
namespace GlitchyScrap.src.Shared
{
	internal class CollectionDisplay : MonoBehaviour
	{
		public bool useCustomPosition;

		public Vector3 overridePositionValue;

		public bool useCustomRotation;

		public Vector3 overrideRotationValue;

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(FrameDelay());
		}

		private IEnumerator FrameDelay()
		{
			yield return (object)new WaitForEndOfFrame();
			if ((Object)(object)((Component)this).GetComponent<GrabbableObject>() == (Object)null)
			{
				OverrideScrapCollectionDisplay();
			}
		}

		public void OverrideScrapCollectionDisplay()
		{
			//IL_000f: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			if (useCustomPosition)
			{
				((Component)this).transform.localPosition = overridePositionValue;
			}
			if (useCustomRotation)
			{
				((Component)this).transform.rotation = Quaternion.Euler(overrideRotationValue);
			}
		}
	}
	internal class ItemVariant : MonoBehaviour
	{
		private IUseSaveData? grabbableObj;

		private static Random? theEvil;

		private static int previousSeed;

		[field: SerializeField]
		public List<ItemVariantData> ScrapVariants { get; set; } = new List<ItemVariantData>();

		private static Random GetRandom
		{
			get
			{
				if (theEvil == null || StartOfRound.Instance.randomMapSeed != previousSeed)
				{
					previousSeed = StartOfRound.Instance.randomMapSeed;
					theEvil = new Random(previousSeed);
				}
				return theEvil;
			}
		}

		public void Start()
		{
			Item itemProperties = ((Component)((Component)this).transform).GetComponent<GrabbableObject>().itemProperties;
			int count = ScrapVariants.Count;
			if (count > 0 && (Object)(object)itemProperties != (Object)null && itemProperties.saveItemVariable)
			{
				((MonoBehaviour)this).StartCoroutine(WaitToApply());
			}
		}

		private IEnumerator WaitToApply()
		{
			yield return (object)new WaitForEndOfFrame();
			grabbableObj = ((Component)((Component)this).transform).GetComponent<IUseSaveData>();
			if (grabbableObj == null)
			{
				yield break;
			}
			int num = grabbableObj.GetData();
			while (num == 0)
			{
				yield return null;
				num = grabbableObj.GetData();
				if (GameNetworkManager.Instance.gameHasStarted)
				{
					num = GetRandom.Next(0, ScrapVariants.Count) + 1;
					grabbableObj.SaveData(num);
				}
			}
			Apply(num);
		}

		private void Apply(int variant)
		{
			if (variant >= 1)
			{
				int num = variant - 1;
				if (num > ScrapVariants.Count)
				{
					num %= ScrapVariants.Count;
				}
				ItemVariantData i = ScrapVariants[num];
				ThisIsTemporaryUntilXuPutsExperimentalBranchIntoMainBranchGreed(i);
			}
		}

		private void ThisIsTemporaryUntilXuPutsExperimentalBranchIntoMainBranchGreed(ItemVariantData i)
		{
			if (!((Object)(object)i.overrideMaterial != (Object)null))
			{
				return;
			}
			Renderer componentInChildren = ((Component)this).GetComponentInChildren<Renderer>();
			Material[] array = (Material[])(object)new Material[componentInChildren.materials.Length];
			for (int j = 0; j < array.Length; j++)
			{
				if (j == i.materialToChange)
				{
					array[j] = i.overrideMaterial;
				}
				else
				{
					array[j] = componentInChildren.materials[j];
				}
			}
			componentInChildren.materials = array;
		}
	}
	internal interface IUseSaveData
	{
		int GetData();

		void SaveData(int data);
	}
	[CreateAssetMenu(fileName = "NewItemVariant", menuName = "ScriptableObjects/Variant Data", order = 1)]
	public class ItemVariantData : ScriptableObject
	{
		public int weight;

		public Material? overrideMaterial;

		public int materialToChange;
	}
	[CreateAssetMenu(fileName = "NewPaintItemVariant", menuName = "ScriptableObjects/Paint Variant Data", order = 1)]
	public class PaintCanVariantData : ItemVariantData
	{
		public Material paintMat;
	}
}
namespace GlitchyScrap.src.Patches
{
	internal class DamageDetectionPatch
	{
		private static bool patched;

		internal static Harmony? Harmony { get; set; }

		public static void PatchPlayer()
		{
			//IL_0019: 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_0024: Expected O, but got Unknown
			if (!patched)
			{
				patched = true;
				if (Harmony == null)
				{
					Harmony = new Harmony("DamageDetectionPatch");
				}
				Harmony.PatchAll(typeof(ElecricDamagePatch));
			}
		}
	}
	internal class ElecricDamagePatch
	{
		[HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")]
		[HarmonyPostfix]
		private static void DamagePlayer(PlayerControllerB __instance, CauseOfDeath causeOfDeath, int damageNumber)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			if ((int)causeOfDeath != 11)
			{
				return;
			}
			GrabbableObject[] itemSlots = __instance.ItemSlots;
			foreach (GrabbableObject val in itemSlots)
			{
				if (val is BulbScrap bulbScrap)
				{
					bulbScrap.AddCharge(damageNumber / 10);
				}
			}
		}
	}
	internal static class ExplosiveScrap
	{
		private static bool patched;

		internal static Harmony? Harmony { get; set; }

		public static void PatchLandmines()
		{
			//IL_0019: 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_0024: Expected O, but got Unknown
			if (!patched)
			{
				patched = true;
				if (Harmony == null)
				{
					Harmony = new Harmony("ScrapLandmineInteractionPatch");
				}
				Harmony.PatchAll(typeof(ScrapLandmineInteractionPatch));
			}
		}
	}
	internal class ScrapLandmineInteractionPatch
	{
		[HarmonyPatch(typeof(Landmine), "SpawnExplosion")]
		[HarmonyPostfix]
		private static void SpawnExplosion(Vector3 explosionPosition, float killRange, float damageRange)
		{
			//IL_0000: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0047: 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_0056: 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++)
			{
				ExtendedGrabbableObject component = ((Component)array[i]).GetComponent<ExtendedGrabbableObject>();
				if (component is IExplosionInteraction explosionInteraction)
				{
					float num = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position);
					if (!Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.25f, ref val, 1073742080, (QueryTriggerInteraction)1) || (((Component)((RaycastHit)(ref val)).collider).gameObject.layer != 30 && !(num > 4f)))
					{
						explosionInteraction.HitByExplosion(killRange == 2.4f && damageRange == 5f);
					}
				}
			}
		}
	}
	internal class LightningStrikePatch
	{
		private static bool patched;

		internal static Harmony? Harmony { get; set; }

		public static void PatchLightning()
		{
			//IL_0019: 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_0024: Expected O, but got Unknown
			if (!patched)
			{
				patched = true;
				if (Harmony == null)
				{
					Harmony = new Harmony("LightningDetectionPatch");
				}
				Harmony.PatchAll(typeof(LightningDetectionPatch));
			}
		}
	}
	internal class LightningDetectionPatch
	{
		[HarmonyPatch(typeof(StormyWeather), "LightningStrike")]
		[HarmonyPostfix]
		private static void LightningStrike(Vector3 strikePosition)
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapSphere(strikePosition + Vector3.up * 0.25f, 5f, 10);
			for (int i = 0; i < array.Length; i++)
			{
				PlayerControllerB component = ((Component)array[i]).GetComponent<PlayerControllerB>();
				if ((Object)(object)component == (Object)null)
				{
					break;
				}
				GrabbableObject[] itemSlots = component.ItemSlots;
				foreach (GrabbableObject val in itemSlots)
				{
					if (val is BulbScrap bulbScrap)
					{
						bulbScrap.HitByExplosion(isLightning: true);
					}
				}
			}
		}
	}
}
namespace GlitchyScrap.src.Behaviours
{
	internal class AudioMimicScrap
	{
	}
	internal class BulbScrap : GrabbableObject, IExplosionInteraction
	{
		private bool isBulbEnabled = true;

		public Light light;

		private float charge;

		private int maxCharge = 5;

		public float maxIntensity = 70f;

		public float fadeModifier;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			if ((Object)(object)light != (Object)null)
			{
				((Behaviour)light).enabled = false;
				if (fadeModifier <= 0f)
				{
					fadeModifier = 1f;
				}
			}
			else
			{
				isBulbEnabled = false;
			}
		}

		public void AddCharge(int value)
		{
			SetChargeRpc(value, add: true);
		}

		public void SetCharge(int value)
		{
			SetChargeRpc(value, add: false);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void SetChargeRpc(int value, bool add)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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 val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3962943151u, val3, val, (SendTo)7, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, value);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref add, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 3962943151u, val3, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (isBulbEnabled)
				{
					charge = (add ? ((int)Mathf.Min(charge + (float)value, (float)maxCharge)) : value);
				}
			}
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (isBulbEnabled && charge > 0f)
			{
				((Behaviour)light).enabled = !base.isPocketed;
				light.intensity = Mathf.Lerp(0f, maxIntensity, charge / fadeModifier);
				charge -= Time.deltaTime / fadeModifier;
				if (charge <= 0f)
				{
					((Behaviour)light).enabled = false;
				}
			}
		}

		public void HitByExplosion(bool isLightning)
		{
			if (isLightning)
			{
				SetCharge(5);
			}
		}

		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
			((NetworkBehaviour)this).__registerRpc(3962943151u, new RpcReceiveHandler(__rpc_handler_3962943151), "SetChargeRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_3962943151(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int value = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref value);
				bool add = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref add, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BulbScrap)(object)target).SetChargeRpc(value, add);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "BulbScrap";
		}
	}
	internal class ExtendedGrabbableObject : GrabbableObject, IUseSaveData
	{
		private int saveData;

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			this.saveData = saveData;
		}

		public int GetData()
		{
			return saveData;
		}

		public override int GetItemDataToSave()
		{
			((GrabbableObject)this).GetItemDataToSave();
			return saveData;
		}

		public void SaveData(int data)
		{
			saveData = data;
		}

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ExtendedGrabbableObject";
		}
	}
	internal interface IExplosionInteraction
	{
		void HitByExplosion(bool isLightning);
	}
	internal class SlinkyScrap : ExtendedGrabbableObject
	{
		public float stableAngle = 30f;

		public float horizontalSearchDistance = 0.75f;

		public float dropDistance = 1f;

		public float minDropRequirement = 0.22f;

		public float steppySpeed = 1f;

		public AudioClip? sproing;

		private AudioSource Source;

		public Transform[] bones;

		private float restingStateBoneSpacing = 0.04f;

		private bool leadingEnd;

		private Vector3 previousPosition;

		private Vector3 middlePosition;

		private Vector3 nextPosition;

		private Vector3 nextNormal;

		private bool wasPlaced;

		public override void OnDestroy()
		{
			//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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_004a: 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_0050: 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)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = -Vector3.up * 0.01f;
			for (int i = 0; i < bones.Length; i++)
			{
				float num = (float)i / ((float)bones.Count() - 1f);
				Transform obj = bones[i];
				Vector3 val2 = val + Vector3.Slerp(Vector3.right * 0.2f - val, Vector3.left * 0.2f - val, num);
				Quaternion val3 = (bones[i].rotation = Quaternion.AngleAxis(num * 180f, Vector3.forward) * ((num > 0.5f) ? Quaternion.Euler(0f, 0f, 180f) : Quaternion.identity));
				obj.SetLocalPositionAndRotation(val2, val3);
			}
		}

		public override void Start()
		{
			((GrabbableObject)this).Start();
			Source = ((Component)this).GetComponent<AudioSource>();
		}

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

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

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

		private void ResetPosition()
		{
			//IL_0029: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			wasPlaced = false;
			for (int i = 0; i < bones.Length; i++)
			{
				float num = (float)i / ((float)bones.Count() - 1f);
				bones[i].SetLocalPositionAndRotation(Vector3.up * Mathf.Lerp(((GrabbableObject)this).itemProperties.verticalOffset, 0f - ((GrabbableObject)this).itemProperties.verticalOffset, num), (i < bones.Count() / 2) ? Quaternion.Euler(0f, 0f, 180f) : Quaternion.identity);
			}
		}

		public override void OnHitGround()
		{
			//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_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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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)
			previousPosition = Vector3.zero;
			middlePosition = (nextPosition = ((GrabbableObject)this).targetFloorPosition);
			RaycastHit val = default(RaycastHit);
			if (((NetworkBehaviour)this).IsHost && !wasPlaced && Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, 0.2f, 268437761, (QueryTriggerInteraction)1))
			{
				nextNormal = ((RaycastHit)(ref val)).normal;
				if (OnUnstableGround())
				{
					((MonoBehaviour)this).StartCoroutine(IFirstStep());
				}
			}
		}

		private bool OnUnstableGround()
		{
			//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_0041: 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_0019: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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)
			if (Vector3.Angle(nextNormal, Vector3.up) > stableAngle)
			{
				Vector3 val = nextNormal;
				val.y = 0f;
				Vector3.Normalize(val);
				if (ProbeSurface(val))
				{
					return true;
				}
			}
			else if (previousPosition == Vector3.zero)
			{
				if (ProbeSurface(Vector3.forward))
				{
					return true;
				}
				if (ProbeSurface(Vector3.right))
				{
					return true;
				}
				if (ProbeSurface(Vector3.back))
				{
					return true;
				}
				if (ProbeSurface(Vector3.left))
				{
					return true;
				}
			}
			else
			{
				Vector3 val = middlePosition - previousPosition;
				val.y = 0f;
				Vector3.Normalize(val);
				if (ProbeSurface(val))
				{
					return true;
				}
			}
			nextPosition = Vector3.zero;
			return false;
		}

		private bool ProbeSurface(Vector3 direction)
		{
			//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_0016: 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_0018: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_003a: 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)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_00a1: 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_00ae: 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)
			Vector3 val = ((Component)this).transform.parent.TransformPoint(nextPosition);
			Vector3 val2 = val + direction * horizontalSearchDistance;
			RaycastHit val3 = default(RaycastHit);
			if (!Physics.Linecast(val + Vector3.up * 0.5f, val2, 268437761) && Physics.Raycast(val2, Vector3.down, ref val3, dropDistance, 268437761, (QueryTriggerInteraction)1) && ((RaycastHit)(ref val3)).distance > minDropRequirement && ((Object)((RaycastHit)(ref val3)).collider).name != "OutOfBoundsTerrain")
			{
				nextPosition = ((Component)this).transform.parent.InverseTransformPoint(((RaycastHit)(ref val3)).point);
				nextNormal = ((RaycastHit)(ref val3)).normal;
				return true;
			}
			return false;
		}

		private IEnumerator IFirstStep()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => ((GrabbableObject)this).reachedFloorTarget));
			yield return (object)new WaitForSeconds(0.01f);
			if (!((Object)(object)((Component)this).transform.parent == (Object)null))
			{
				SlinkyStepRPC(nextPosition);
			}
		}

		private void PrepareNextStep()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			OnUnstableGround();
			SlinkyStepRPC(nextPosition);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void SlinkyStepRPC(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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(4103021773u, val3, val, (SendTo)7, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 4103021773u, val3, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StartCoroutine(IStep(previousPosition, middlePosition, position));
				}
			}
		}

		private IEnumerator IStep(Vector3 fromPos, Vector3 midPos, Vector3 toPos)
		{
			//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)
			//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)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			float timer = 0f;
			bool sfxPlayedThisStep = false;
			bool loopStep = false;
			leadingEnd = !leadingEnd;
			previousPosition = midPos;
			middlePosition = toPos;
			while (((GrabbableObject)this).reachedFloorTarget && timer < 1.005f)
			{
				if (fromPos == Vector3.zero)
				{
					leadingEnd = true;
					InitialStep(timer, midPos, toPos);
				}
				else if (toPos == Vector3.zero)
				{
					ReturnStep(timer, fromPos, midPos, leadingEnd);
				}
				else
				{
					loopStep = true;
					LoopedStep(timer, fromPos, midPos, toPos, leadingEnd);
				}
				if (!sfxPlayedThisStep && timer > 0.25f)
				{
					Source.PlayOneShot(sproing);
					sfxPlayedThisStep = true;
				}
				timer += Time.deltaTime * steppySpeed * (float)(loopStep ? 1 : 2);
				yield return null;
			}
			if (((NetworkBehaviour)this).IsServer && toPos != Vector3.zero)
			{
				PrepareNextStep();
			}
		}

		private void InitialStep(float timer, Vector3 fromPos, Vector3 toPos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001d: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0082: 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_009f: 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_00aa: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_00fb: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: 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)
			((GrabbableObject)this).targetFloorPosition = Vector3.Lerp(fromPos + Vector3.up * ((GrabbableObject)this).itemProperties.verticalOffset, (toPos + fromPos) / 2f, timer);
			Vector3 val = Vector3.Cross(toPos - fromPos, Vector3.up);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			for (int i = 0; i < bones.Length; i++)
			{
				float num = (float)i / ((float)bones.Count() - 1f);
				bones[i].SetPositionAndRotation(((Component)this).transform.parent.TransformPoint(Vector3.Lerp(fromPos + (float)(bones.Count() - 1 - i) * restingStateBoneSpacing * Vector3.up, Vector3.Lerp(fromPos, toPos, 1f - num) + 0.2f * Mathf.Sin(num * MathF.PI) * Vector3.up, timer)), Quaternion.AngleAxis((1f - num) * Mathf.Lerp(0f, -180f, timer), normalized) * ((1f - num > 0.5f) ? Quaternion.Euler(0f, 0f, 180f) : Quaternion.identity));
			}
		}

		private void ReturnStep(float timer, Vector3 fromPos, Vector3 toPos, bool end)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0082: 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_0092: 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_00ae: 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_00b8: 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)
			//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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).targetFloorPosition = Vector3.Lerp((fromPos + toPos) / 2f, toPos + Vector3.up * ((GrabbableObject)this).itemProperties.verticalOffset, timer);
			Vector3 val = Vector3.Cross(toPos - fromPos, Vector3.up);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			for (int i = 0; i < bones.Length; i++)
			{
				float num = (float)i / ((float)bones.Count() - 1f);
				bones[i].SetPositionAndRotation(((Component)this).transform.parent.TransformPoint(Vector3.Lerp(Vector3.Lerp(fromPos, toPos, end ? num : (1f - num)) + 0.2f * Mathf.Sin(num * MathF.PI) * Vector3.up, toPos + (float)(end ? (bones.Count() - 1 - i) : i) * restingStateBoneSpacing * Vector3.up, timer)), Quaternion.AngleAxis((end ? (1f - num) : num) * Mathf.Lerp(180f, 0f, timer), normalized) * (((end ? (1f - num) : num) > 0.5f) ? Quaternion.Euler(0f, 0f, 180f) : Quaternion.identity));
			}
		}

		private void LoopedStep(float timer, Vector3 fromPos, Vector3 midPos, Vector3 toPos, bool end)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0054: 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_005a: 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_0067: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_00b5: 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_00c7: 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_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_00ef: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: 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_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: 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_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).targetFloorPosition = Vector3.Lerp((fromPos + midPos) / 2f, (toPos + midPos) / 2f, timer);
			Vector3 val;
			Vector3 normalized;
			if (!(timer < 0.25f))
			{
				val = Vector3.Cross(toPos - midPos, Vector3.up);
				normalized = ((Vector3)(ref val)).normalized;
			}
			else
			{
				val = Vector3.Cross(midPos - fromPos, Vector3.up);
				normalized = ((Vector3)(ref val)).normalized;
			}
			Vector3 val2 = normalized;
			Vector3 val3 = midPos - Vector3.up * 0.5f;
			for (int i = 0; i < bones.Length; i++)
			{
				float num = (float)i / ((float)bones.Count() - 1f);
				bones[i].SetPositionAndRotation(val3 + ((Component)this).transform.parent.TransformPoint(Vector3.Slerp(Vector3.Lerp(fromPos, midPos, end ? num : (1f - num)) + 0.2f * Mathf.Sin(num * MathF.PI) * Vector3.up - val3, Vector3.Lerp(midPos, toPos, end ? (1f - num) : num) + 0.2f * Mathf.Sin(num * MathF.PI) * Vector3.up - val3, timer)), Quaternion.AngleAxis((end ? (1f - num) : num) * AdjustedLerp(180f, -180f, timer), val2) * (((end ? (1f - num) : num) > 0.5f) ? Quaternion.Euler(0f, 0f, 180f) : Quaternion.identity));
			}
		}

		private float AdjustedLerp(float a, float b, float t)
		{
			if (t <= 0.25f)
			{
				return Mathf.Lerp(a, b, t * 2f);
			}
			return Mathf.Lerp(a / 3f, b, t);
		}

		protected override void __initializeVariables()
		{
			base.__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
			((NetworkBehaviour)this).__registerRpc(4103021773u, new RpcReceiveHandler(__rpc_handler_4103021773), "SlinkyStepRPC");
			base.__initializeRpcs();
		}

		private static void __rpc_handler_4103021773(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).SlinkyStepRPC(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SlinkyScrap";
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace GlitchyScrap.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}