Decompiled source of GottaGoLethal v1.0.2

GottaGoLethal.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Extensions;
using CSync.Lib;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SceneManagement;

[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("GottaGoLethal")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GottaGoLethal")]
[assembly: AssemblyTitle("GottaGoLethal")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace GottaGoLethal
{
	public class AssetLoad
	{
		public static AssetBundle MainAssets;

		public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();

		public static ContentLoader ContentLoader;

		public static GameObject configManagerPrefab;

		public static void Init()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			MainAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "gottagolethal"));
			ContentLoader = new ContentLoader(GottaGoLethal.pluginInfo, MainAssets, (Action<CustomContent, GameObject>)delegate(CustomContent content, GameObject prefab)
			{
				Prefabs.Add(content.ID, prefab);
			});
			CustomContent[] array = (CustomContent[])(object)new CustomContent[4]
			{
				(CustomContent)new ScrapItem("SonicRegularRing", "assets/lethalcompany/mods/plugins/jehlou-gottagolethal/gottagolethal/prefabs/sonicregularring.asset", GottaGoConfig.regularRingSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("SonicDeathRing", "assets/lethalcompany/mods/plugins/jehlou-gottagolethal/gottagolethal/prefabs/sonicdeathring.asset", GottaGoConfig.deathRingSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("SonicFalseRing", "assets/lethalcompany/mods/plugins/jehlou-gottagolethal/gottagolethal/prefabs/sonicfalsering.asset", GottaGoConfig.falseRingSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("SonicTeleportRing", "assets/lethalcompany/mods/plugins/jehlou-gottagolethal/gottagolethal/prefabs/sonicteleportring.asset", GottaGoConfig.teleportRingSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null)
			};
			ContentLoader.RegisterAll(array);
		}
	}
	public class GottaGoConfig : SyncedConfig2<GottaGoConfig>
	{
		[SyncedEntryField]
		public static SyncedEntry<int> regularRingSpawnChance;

		[SyncedEntryField]
		public static SyncedEntry<int> deathRingSpawnChance;

		[SyncedEntryField]
		public static SyncedEntry<int> falseRingSpawnChance;

		[SyncedEntryField]
		public static SyncedEntry<int> teleportRingSpawnChance;

		public GottaGoConfig(ConfigFile configFile)
			: base(GottaGoLethal.pluginInfo.Metadata.GUID)
		{
			//IL_0020: 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_003b: Expected O, but got Unknown
			//IL_003b: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0066: Expected O, but got Unknown
			//IL_0076: 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
			//IL_0092: Expected O, but got Unknown
			//IL_00a2: 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_00bd: Expected O, but got Unknown
			//IL_00bd: Expected O, but got Unknown
			regularRingSpawnChance = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, new ConfigDefinition("Spawn Chance", "Regular Ring"), 4, new ConfigDescription("Spawn chance for Regular Ring", (AcceptableValueBase)null, Array.Empty<object>()));
			deathRingSpawnChance = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, new ConfigDefinition("Spawn Chance", "Death Ring"), 8, new ConfigDescription("Spawn chance for Death Ring", (AcceptableValueBase)null, Array.Empty<object>()));
			falseRingSpawnChance = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, new ConfigDefinition("Spawn Chance", "False Ring"), 15, new ConfigDescription("Spawn chance for False Ring", (AcceptableValueBase)null, Array.Empty<object>()));
			teleportRingSpawnChance = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, new ConfigDefinition("Spawn Chance", "Teleport Ring"), 2, new ConfigDescription("Spawn chance for Teleport Ring", (AcceptableValueBase)null, Array.Empty<object>()));
			ConfigManager.Register<GottaGoConfig>((SyncedConfig2<GottaGoConfig>)(object)this);
		}
	}
	[BepInPlugin("GottaGoLethal", "GottaGoLethal", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency("com.sigurd.csync", "5.0.0")]
	public class GottaGoLethal : BaseUnityPlugin
	{
		public const string ModGUID = "jehlou.gottagolethal";

		public const string ModName = "GottaGoLethal";

		public const string ModVersion = "1.0.1";

		public static bool devMode;

		internal static GottaGoConfig Config;

		public static PluginInfo pluginInfo;

		public static GottaGoLethal Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"GottaGoLethal v1.0.0 start loading!");
			Instance = this;
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Config = new GottaGoConfig(((BaseUnityPlugin)this).Config);
			Version version = Chainloader.PluginInfos["evaisa.lethallib"].Metadata.Version;
			if (version.Major > 0 || version.Minor > 11 || (version.Minor == 11 && version.Build >= 2))
			{
				Logger.LogInfo((object)("LethalLib version is " + version.ToString() + ", which is compatible with LethalThings 0.9.0+"));
				AssetLoad.Init();
				Patch();
				Logger.LogInfo((object)"GottaGoLethal v1.0.0 has loaded!");
			}
			else
			{
				Logger.LogError((object)("LethalLib version is " + version.ToString() + ", which is not compatible with LethalThings 0.9.0+"));
				Logger.LogError((object)"Please update LethalLib to version 0.11.2 or newer");
			}
		}

		internal static void Patch()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("GottaGoLethal");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}

		public static void ModifyPlayerDiscardAction(bool enableDiscard, PlayerControllerB playerHeldBy)
		{
			if ((Object)(object)playerHeldBy == (Object)(object)RoundManager.Instance.playersManager.localPlayerController)
			{
				if (enableDiscard)
				{
					IngamePlayerSettings.Instance.playerInput.actions.FindAction("Discard", false).Enable();
				}
				else
				{
					IngamePlayerSettings.Instance.playerInput.actions.FindAction("Discard", false).Disable();
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GottaGoLethal";

		public const string PLUGIN_NAME = "GottaGoLethal";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace GottaGoLethal.Patches
{
	[HarmonyPatch(typeof(TVScript))]
	public class ExampleTVPatch
	{
		[HarmonyPatch("SwitchTVLocalClient")]
		[HarmonyPrefix]
		private static void SwitchTVPrefix(TVScript __instance)
		{
			StartOfRound.Instance.shipRoomLights.SetShipLightsBoolean(__instance.tvOn);
		}
	}
	[HarmonyPatch(typeof(TVScript))]
	public class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void setInfiniteSprint(PlayerControllerB __instance)
		{
		}
	}
}
namespace GottaGoLethal.MonoBehaviours
{
	public class SonicFalseRing : GrabbableObject
	{
		public AudioClip wentFastSound;

		public AudioSource audioSource;

		public void GoFast()
		{
			PlayWentFastSound();
		}

		[ServerRpc]
		public void GoFastServerRpc()
		{
			GoFastClientRpc();
		}

		[ClientRpc]
		public void GoFastClientRpc()
		{
			GoFast();
		}

		private void PlayWentFastSound()
		{
			audioSource.PlayOneShot(wentFastSound, 1f);
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
		}

		public override void GrabItem()
		{
			if (base.isInShipRoom && base.isInElevator)
			{
				GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			}
			((GrabbableObject)this).GrabItem();
		}

		public override void EquipItem()
		{
			if (!base.isInShipRoom && !base.isInElevator)
			{
				GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: false, base.playerHeldBy);
			}
			((GrabbableObject)this).EquipItem();
		}

		public override void DiscardItem()
		{
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			((GrabbableObject)this).DiscardItem();
		}

		public override void OnBroughtToShip()
		{
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			((GrabbableObject)this).OnBroughtToShip();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (((NetworkBehaviour)this).IsOwner)
			{
				GoFastServerRpc();
			}
		}
	}
	public class SonicRegularRing : GrabbableObject
	{
		public float goFastTime = 60f;

		public float goDeadTime = 11.5f;

		public float flingUpAngle = 20f;

		public float flingForce = 1f;

		public bool goingFast;

		public bool wentFast;

		public bool goingToDie;

		public AudioClip goFastSound;

		public AudioClip goDieSound;

		public AudioClip wentFastSound;

		public AudioSource audioSource;

		public GameObject ringSplosionEffect;

		public SonicRigidRing ringWithRigidBody;

		public bool allowdestroy = true;

		public float debugOffset = 1f;

		public void GoFast()
		{
			((MonoBehaviour)this).StartCoroutine(StartGoFastCountdown(goFastTime));
		}

		[ServerRpc]
		public void GoFastServerRpc()
		{
			GoFastClientRpc();
		}

		[ClientRpc]
		public void GoFastClientRpc()
		{
			GoFast();
		}

		private IEnumerator StartGoFastCountdown(float time)
		{
			goingFast = true;
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: false, base.playerHeldBy);
			PlayGoFastSound();
			yield return (object)new WaitForSeconds(time);
			((MonoBehaviour)this).StartCoroutine(StartDeathCountdown(goDeadTime));
		}

		private IEnumerator StartDeathCountdown(float time)
		{
			goingToDie = true;
			PlayGoDieSound();
			yield return (object)new WaitForSeconds(time);
			goingFast = false;
			goingToDie = false;
			wentFast = true;
			PlayWentFastSound();
			SpawnRingSplosion();
			if (allowdestroy)
			{
				((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
			}
		}

		public void SpawnRingSplosion()
		{
			//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_001e: 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)
			SpawnRigidRings(10);
			Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up * 0.5f, true, 5.7f, 6f, 50, 0f, ringSplosionEffect, false);
		}

		public SonicRigidRing[] SpawnRigidRings(int ringcount)
		{
			//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_0034: 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_003e: 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_0059: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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)
			SonicRigidRing[] array = new SonicRigidRing[ringcount];
			float num = 360f / (float)(ringcount - 1);
			for (int i = 0; i < ringcount; i++)
			{
				array[i] = Object.Instantiate<SonicRigidRing>(ringWithRigidBody, ((Component)this).transform.position + Vector3.up * debugOffset, Quaternion.identity);
				Ray flingRingDir = GetFlingRingDir(num * (float)i, flingUpAngle);
				ringWithRigidBody.force = flingForce;
				SonicRigidRing sonicRigidRing = ringWithRigidBody;
				Vector3 direction = ((Ray)(ref flingRingDir)).direction;
				sonicRigidRing.forceDir = ((Vector3)(ref direction)).normalized;
			}
			return array;
		}

		public Ray GetFlingRingDir(float angleAround, float angleUp)
		{
			//IL_0006: 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_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_0022: 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_002d: 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)
			//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_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_0049: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)this).transform.position + Vector3.up * debugOffset;
			Vector3 val2 = Quaternion.AngleAxis(angleUp, Vector3.right) * (Quaternion.AngleAxis(angleAround, Vector3.up) * Vector3.forward);
			Ray result = default(Ray);
			((Ray)(ref result))..ctor(val, val2);
			Debug.DrawRay(((Ray)(ref result)).origin, ((Ray)(ref result)).direction, Color.green, 15f);
			return result;
		}

		public override void Update()
		{
			//IL_0073: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (goingFast && !wentFast && !((Object)(object)base.playerHeldBy == (Object)null))
			{
				base.playerHeldBy.sprintMeter = 1f;
				base.playerHeldBy.isSprinting = true;
				base.playerHeldBy.isExhausted = false;
				base.playerHeldBy.targetFOV = 90f;
				base.playerHeldBy.thisController.Move(base.playerHeldBy.playerEye.forward * (Time.deltaTime * 10f));
			}
		}

		private void PlayGoFastSound()
		{
			audioSource.PlayOneShot(goFastSound, 1f);
		}

		private void PlayGoDieSound()
		{
			audioSource.PlayOneShot(goDieSound, 1f);
		}

		private void PlayWentFastSound()
		{
			audioSource.PlayOneShot(wentFastSound, 1f);
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
		}

		public override void GrabItem()
		{
			if (base.isInShipRoom && base.isInElevator)
			{
				GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			}
			((GrabbableObject)this).GrabItem();
		}

		public override void EquipItem()
		{
			if ((goingFast & !base.isInShipRoom) && !base.isInElevator)
			{
				GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: false, base.playerHeldBy);
			}
			((GrabbableObject)this).EquipItem();
		}

		public override void DiscardItem()
		{
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			((GrabbableObject)this).DiscardItem();
		}

		public override void OnBroughtToShip()
		{
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			((GrabbableObject)this).OnBroughtToShip();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (((NetworkBehaviour)this).IsOwner && !goingFast && !wentFast)
			{
				GoFastServerRpc();
			}
		}
	}
	public class SonicTeleportRing : GrabbableObject
	{
		public float teleporterChargeUp = 2f;

		public AudioSource teleporterAudio;

		public AudioClip teleporterBeamUpSFX;

		public AudioClip teleporterPrimeSFX;

		public void GoTeleport()
		{
			//IL_0022: 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_002d: 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_003b: 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_0041: 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)
			Vector3 position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
			position = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(position, 10f, default(NavMeshHit));
			PlayTeleporterPrimeAudio();
			((MonoBehaviour)this).StartCoroutine(TeleportPlayerCoroutine((int)base.playerHeldBy.playerClientId, position));
		}

		private IEnumerator TeleportPlayerCoroutine(int playerObj, Vector3 teleportPos)
		{
			//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)
			yield return (object)new WaitForSeconds(teleporterChargeUp);
			TeleportPlayerServerRpc(playerObj, teleportPos);
		}

		[ServerRpc(RequireOwnership = false)]
		private void TeleportPlayerServerRpc(int playerObj, Vector3 teleportPos)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			TeleportPlayerClientRpc(playerObj, teleportPos);
		}

		[ClientRpc]
		private void TeleportPlayerClientRpc(int playerObj, Vector3 teleportPos)
		{
			//IL_002e: 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)
			PlayTeleporterBeamUpAudio();
			if (StartOfRound.Instance.allPlayerScripts[playerObj].isPlayerDead)
			{
				TeleportPlayerBody(playerObj, teleportPos);
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else
			{
				TeleportPlayer(playerObj, teleportPos);
				((GrabbableObject)this).DestroyObjectInHand(StartOfRound.Instance.allPlayerScripts[playerObj]);
			}
		}

		public static IEnumerator TeleportPlayerBody(int playerObj, Vector3 teleportPosition)
		{
			//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)
			float startTime = Time.realtimeSinceStartup;
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)StartOfRound.Instance.allPlayerScripts[playerObj].deadBody != (Object)null || Time.realtimeSinceStartup - startTime > 2f));
			if (StartOfRound.Instance.inShipPhase || SceneManager.sceneCount <= 1)
			{
				yield break;
			}
			DeadBodyInfo deadBody = StartOfRound.Instance.allPlayerScripts[playerObj].deadBody;
			if ((Object)(object)deadBody != (Object)null)
			{
				deadBody.attachedTo = null;
				deadBody.attachedLimb = null;
				deadBody.secondaryAttachedLimb = null;
				deadBody.secondaryAttachedTo = null;
				if ((Object)(object)deadBody.grabBodyObject != (Object)null && deadBody.grabBodyObject.isHeld && (Object)(object)deadBody.grabBodyObject.playerHeldBy != (Object)null)
				{
					deadBody.grabBodyObject.playerHeldBy.DropAllHeldItems(true, false);
				}
				deadBody.isInShip = false;
				deadBody.parentedToShip = false;
				((Component)deadBody).transform.SetParent((Transform)null, true);
				deadBody.SetRagdollPositionSafely(teleportPosition, true);
			}
		}

		public static void TeleportPlayer(int playerObj, Vector3 teleportPos)
		{
			//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_0062: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj];
			if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
			{
				Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(val);
			}
			val.isInElevator = false;
			val.isInHangarShipRoom = false;
			val.isInsideFactory = true;
			val.averageVelocity = 0f;
			val.velocityLastFrame = Vector3.zero;
			StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(teleportPos, false, 0f, false, true);
			StartOfRound.Instance.allPlayerScripts[playerObj].beamOutParticle.Play();
			if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
		}

		private void PlayTeleporterPrimeAudio()
		{
			teleporterAudio.PlayOneShot(teleporterPrimeSFX);
			base.playerHeldBy.movementAudio.PlayOneShot(teleporterPrimeSFX);
		}

		private void PlayTeleporterBeamUpAudio()
		{
			teleporterAudio.PlayOneShot(teleporterBeamUpSFX);
			base.playerHeldBy.movementAudio.PlayOneShot(teleporterBeamUpSFX);
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
		}

		public override void GrabItem()
		{
			if (base.isInShipRoom && base.isInElevator)
			{
				GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			}
			((GrabbableObject)this).GrabItem();
		}

		public override void EquipItem()
		{
			if (!base.isInShipRoom && !base.isInElevator)
			{
				GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: false, base.playerHeldBy);
			}
			((GrabbableObject)this).EquipItem();
		}

		public override void DiscardItem()
		{
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			((GrabbableObject)this).DiscardItem();
		}

		public override void OnBroughtToShip()
		{
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			((GrabbableObject)this).OnBroughtToShip();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (((NetworkBehaviour)this).IsOwner)
			{
				GoTeleport();
			}
		}
	}
	public class SonicRigidRing : MonoBehaviour
	{
		internal Rigidbody rb;

		public GrabbableObject sonicFalseRing;

		public float spawnVelocity = 0.1f;

		public float force = 1f;

		public Vector3 forceDir;

		public void Awake()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
			rb.WakeUp();
		}

		public void FixedUpdate()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_007e: 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_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_0034: 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)
			if (force > 0f)
			{
				Debug.DrawRay(((Component)this).transform.position, forceDir, Color.red, 15f);
				rb.AddForce(forceDir * force, (ForceMode)1);
				force = 0f;
				return;
			}
			Vector3 velocity = rb.velocity;
			Debug.Log((object)((Vector3)(ref velocity)).magnitude);
			velocity = rb.velocity;
			if (!(((Vector3)(ref velocity)).magnitude > spawnVelocity))
			{
				SpawnFalseRing();
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public void SpawnFalseRing()
		{
			//IL_0006: 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_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_001f: 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_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_0046: 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_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_0067: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)this).transform.position + Vector3.up * 0.5f;
			Vector3 targetFloorPosition = ((Component)this).transform.position + Vector3.up * 0.5f;
			GrabbableObject val2 = Object.Instantiate<GrabbableObject>(sonicFalseRing, val, Quaternion.identity);
			((Component)val2).GetComponent<NetworkObject>().Spawn(false);
			val2.startFallingPosition = val;
			val2.targetFloorPosition = targetFloorPosition;
			val2.playerHeldBy = null;
			val2.reachedFloorTarget = false;
			val2.hasHitGround = false;
			val2.fallTime = 0f;
			val2.grabbable = true;
			val2.FallToGround(false);
		}
	}
	public class TailsDollAI : EnemyAI
	{
		[Header("Behaviors")]
		public AISearchRoutine searchForPlayers;

		public bool investigating;

		public bool hasBegunInvestigating;

		public Vector3 investigatePosition;

		private float angeredTimer;

		[Header("Audio")]
		public AudioSource tailsAudio;

		public AudioSource floatAudio;

		public AudioClip fullSong;

		public AudioClip canYouHearTheSunshine;

		public AudioClip itMakesMeWantToSurvive;

		public AudioClip youJustNeedToRunAway;

		public AudioClip whenYourHereIWishYouWereAlwaysNear;

		public AudioClip attackSound;

		private List<Light> lights = new List<Light>();

		public float rubyLightInterval = 1f;

		public float rubylightTimer;

		public float lightOnDuration = 0.1f;

		public override void Start()
		{
			((EnemyAI)this).Start();
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			if (!base.isEnemyDead)
			{
				_ = StartOfRound.Instance.allPlayersDead;
			}
		}

		private void FixedUpdate()
		{
			_ = base.ventAnimationFinished;
		}

		public override void Update()
		{
			((EnemyAI)this).Update();
		}

		private void OnTriggerEnter(Collider other)
		{
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, false, -1);
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
		}
	}
}