Decompiled source of ButteryFixes v1.16.3

ButteryFixes.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
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 ButteryFixes.Utility;
using DunGen;
using DunGen.Graph;
using GameNetcodeStuff;
using HarmonyLib;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("ButteryFixes")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Bundle of miscellaneous vanilla-compatible fixes")]
[assembly: AssemblyFileVersion("1.16.3.0")]
[assembly: AssemblyInformationalVersion("1.16.3+f63d510450adf62d1494515877b7713a24461137")]
[assembly: AssemblyProduct("ButteryFixes")]
[assembly: AssemblyTitle("ButteryFixes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.16.3.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ButteryFixes
{
	internal class Compatibility
	{
		internal const string GUID_LETHAL_FIXES = "uk.1a3.lethalfixes";

		internal const string GUID_GENERAL_IMPROVEMENTS = "ShaosilGaming.GeneralImprovements";

		internal const string GUID_BETTER_SPRAY_PAINT = "taffyko.BetterSprayPaint";

		internal const string GUID_EVERYTHING_CAN_DIE = "nwnt.EverythingCanDie";

		internal const string GUID_MORE_COMPANY = "me.swipez.melonloader.morecompany";

		internal const string GUID_TOUCHSCREEN = "me.pm.TheDeadSnake";

		internal const string GUID_REBALANCED_MOONS = "dopadream.lethalcompany.rebalancedmoons";

		internal const string GUID_CRUISER_ADDITIONS = "4902.Cruiser_Additions";

		internal const string GUID_TERMINAL_STUFF = "darmuh.TerminalStuff";

		internal const string GUID_LOBBY_COMPATIBILITY = "BMX.LobbyCompatibility";

		internal const string GUID_YES_FOX = "uk.1a3.yesfox";

		internal const string GUID_OPEN_BODY_CAMS = "Zaggy1024.OpenBodyCams";

		internal const string GUID_NO_LOST_SIGNAL = "Tomatobird.NoLostSignal";

		internal const string GUID_DROP_SHIP_DELIVERY_CAP_MODIFIER = "com.github.Sylkadi.DropShipDeliveryCapModifier";

		internal const string GUID_CRUISER_IMPROVED = "DiggC.CruiserImproved";

		internal static bool INSTALLED_GENERAL_IMPROVEMENTS;

		internal static bool INSTALLED_MORE_COMPANY;

		internal static bool INSTALLED_EVERYTHING_CAN_DIE;

		internal static bool INSTALLED_REBALANCED_MOONS;

		internal static bool DISABLE_SPRAY_PAINT_PATCHES;

		internal static bool DISABLE_INTERACT_FIX;

		internal static bool DISABLE_PRICE_TEXT_FITTING;

		internal static bool ENABLE_VAIN_SHROUDS;

		internal static bool DISABLE_ROTATION_PATCH;

		internal static bool DISABLE_SIGNAL_PATCH;

		internal static bool DISABLE_PURCHASE_CAP_PATCH;

		internal static bool DISABLE_SCAN_PATCH;

		internal static void Init()
		{
			if (Chainloader.PluginInfos.ContainsKey("ShaosilGaming.GeneralImprovements"))
			{
				INSTALLED_GENERAL_IMPROVEMENTS = true;
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - GeneralImprovements detected");
			}
			if (Chainloader.PluginInfos.ContainsKey("taffyko.BetterSprayPaint"))
			{
				DISABLE_SPRAY_PAINT_PATCHES = true;
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - Spray paint patches will be disabled");
			}
			if (Chainloader.PluginInfos.ContainsKey("nwnt.EverythingCanDie"))
			{
				INSTALLED_EVERYTHING_CAN_DIE = true;
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - Everything Can Die detected");
			}
			if (Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany"))
			{
				INSTALLED_MORE_COMPANY = true;
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - More Company detected");
			}
			if (Chainloader.PluginInfos.ContainsKey("me.pm.TheDeadSnake"))
			{
				DISABLE_INTERACT_FIX = true;
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - Touchscreen detected");
			}
			if (Chainloader.PluginInfos.ContainsKey("dopadream.lethalcompany.rebalancedmoons"))
			{
				INSTALLED_REBALANCED_MOONS = true;
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - Rebalanced Moons detected");
			}
			if (INSTALLED_GENERAL_IMPROVEMENTS || Chainloader.PluginInfos.ContainsKey("darmuh.TerminalStuff"))
			{
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - Price text patch will be disabled");
				DISABLE_PRICE_TEXT_FITTING = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility"))
			{
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - Lobby Compatibility detected");
				LobbyCompatibility.Init();
			}
			if (Chainloader.PluginInfos.ContainsKey("uk.1a3.yesfox"))
			{
				ENABLE_VAIN_SHROUDS = true;
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - YesFox detected");
			}
			if (Chainloader.PluginInfos.ContainsKey("Zaggy1024.OpenBodyCams"))
			{
				DISABLE_ROTATION_PATCH = true;
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - OpenBodyCams detected");
			}
			if (Chainloader.PluginInfos.ContainsKey("Tomatobird.NoLostSignal"))
			{
				DISABLE_SIGNAL_PATCH = true;
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - NoLostSignal detected");
			}
			if (INSTALLED_GENERAL_IMPROVEMENTS || Chainloader.PluginInfos.ContainsKey("com.github.Sylkadi.DropShipDeliveryCapModifier"))
			{
				DISABLE_PURCHASE_CAP_PATCH = true;
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - Purchase cap patch (x12) will be disabled");
			}
			if (Chainloader.PluginInfos.ContainsKey("DiggC.CruiserImproved"))
			{
				DISABLE_SCAN_PATCH = true;
				Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - CruiserImproved detected");
			}
		}
	}
	internal enum MusicDopplerLevel
	{
		Vanilla = -1,
		None,
		Reduced
	}
	internal enum GameResolution
	{
		DontChange = -1,
		Low,
		High
	}
	internal enum FilmGrains
	{
		None = -1,
		MenusOnly,
		Full
	}
	internal class Configuration
	{
		private static ConfigFile configFile;

		internal static ConfigEntry<MusicDopplerLevel> musicDopplerLevel;

		internal static ConfigEntry<GameResolution> gameResolution;

		internal static ConfigEntry<bool> makeConductive;

		internal static ConfigEntry<bool> fixJumpCheese;

		internal static ConfigEntry<bool> keysAreScrap;

		internal static ConfigEntry<bool> showApparatusValue;

		internal static ConfigEntry<bool> randomizeDefaultSeed;

		internal static ConfigEntry<bool> scanImprovements;

		internal static ConfigEntry<bool> fixFireExits;

		internal static ConfigEntry<bool> fixSurfacePrices;

		internal static ConfigEntry<bool> lockInTerminal;

		internal static ConfigEntry<bool> filterDecor;

		internal static ConfigEntry<bool> fixGiantSight;

		internal static ConfigEntry<bool> typeGordion;

		internal static ConfigEntry<bool> restoreArtificeAmbience;

		internal static ConfigEntry<bool> disableLODFade;

		internal static ConfigEntry<bool> playermodelPatches;

		internal static ConfigEntry<bool> patchLadders;

		internal static ConfigEntry<bool> alterBestiary;

		internal static ConfigEntry<bool> adjustCooldowns;

		internal static ConfigEntry<bool> autoCollect;

		internal static ConfigEntry<bool> endOrbitEarly;

		internal static ConfigEntry<bool> noBodyNoSignal;

		internal static ConfigEntry<bool> theGoldenGoblet;

		internal static ConfigEntry<bool> charredBodies;

		internal static ConfigEntry<bool> patchPocketLights;

		internal static ConfigEntry<bool> bodiesCollectSelf;

		internal static ConfigEntry<FilmGrains> restoreFilmGrain;

		internal static void Init(ConfigFile cfg)
		{
			configFile = cfg;
			CompatibilityConfig();
			GameplayConfig();
			VisualConfig();
			AudioConfig();
			ExtraConfig();
			MigrateLegacyConfigs();
		}

		private static void CompatibilityConfig()
		{
			patchLadders = configFile.Bind<bool>("Compatibility", "PatchLadders", true, "Fixes stamina being wasted if you hold the sprint button on ladders. This will prevent other mods (Better Ladders, Fast Climbing, Better Stamina, General Improvements, etc.) from allowing ladder sprint as a feature.");
			autoCollect = configFile.Bind<bool>("Compatibility", "AutoCollect", true, "When you board the ship, all scrap in your inventory should immediately display as collected on the HUD. If you encounter problems with inventory or item collection, see if turning this off helps.");
			bodiesCollectSelf = configFile.Bind<bool>("Compatibility", "BodiesCollectSelf", true, "Bodies will automatically collect themselves when teleported to the ship, or when players die inside of the ship.");
			endOrbitEarly = configFile.Bind<bool>("Compatibility", "EndOrbitEarly", true, "Vanilla has a bug where orbit phase only ends for clients after the ship doors open, instead of after the lever is pulled, like for the host. This causes certain objects and enemies to desync, most notably the Giant Sapsucker (which becomes unable to damage clients) and its eggs (which hatch instantly).\nEnabling this setting will fix this core problem, but might cause unexpected behavior with other mods, if they assume vanilla's behavior.");
			patchPocketLights = configFile.Bind<bool>("Compatibility", "PatchPocketLights", true, "Patches some logic with the \"helmet lights\", from pocketed light sources. This fixes a vanilla bug where turning on two different types of lights (ex: a pro-flashlight and a laser pointer) and putting both in your pockets would result in only one displaying, while both continue to drain battery. (As a side effect, this also prevents the exploit where you can play with a permanent helmet light, from a flashlight that's not in your inventory)");
		}

		private static void GameplayConfig()
		{
			randomizeDefaultSeed = configFile.Bind<bool>("Gameplay", "RandomizeDefaultSeed", true, "(Host only) Randomizes the seed when starting a new save file, rather than always using the default of 0. (This changes starting weather and shop sales.)");
			fixFireExits = configFile.Bind<bool>("Gameplay", "FixFireExits", true, "Fix fire exit rotation so you are always facing away from the door when you leave. This applies to interiors, as well as the exteriors of the original game's moons.");
			makeConductive = configFile.Bind<bool>("Gameplay", "MakeConductive", true, "(Host only) Makes some metallic items that are non-conductive in vanilla actually conductive. This fix applies sensibly to the existing items, but you can disable it if you are used to vanilla's properties.");
			keysAreScrap = configFile.Bind<bool>("Gameplay", "KeysAreScrap", false, "(Host only) Enabling this will allow you to sell keys for $3 as listed, but will also cause them to be lost if all players die, and block belt bags from grabbing them. If this is disabled, they will no longer show \"Value: $3\" on the scanner, instead.");
			fixJumpCheese = configFile.Bind<bool>("Gameplay", "FixJumpCheese", true, "(Host only) Enabling this makes enemies hear players jumping and landing on the floor. This fixes the exploit where you can silently move past dogs with sprinting speed by spamming the jump button.");
			fixSurfacePrices = configFile.Bind<bool>("Gameplay", "FixSurfacePrices", true, "(Host only) Fixes individual bee hives not having separate prices from one another. (In vanilla, all hives fall into two price classes depending on distance from ship) This also fixes sapsucker eggs having inconsistent prices on identical seeds.");
			fixGiantSight = configFile.Bind<bool>("Gameplay", "FixGiantSight", true, "(Host only) Fix Forest Keepers permanently remembering players and instantly entering chase on-sight. (Their memory is meant to decay when those players are not visible, but due to a logical error, it can never decrease unless at least one other player is being observed by the giant.)");
		}

		private static void VisualConfig()
		{
			gameResolution = configFile.Bind<GameResolution>("Visual", "GameResolution", GameResolution.DontChange, "The internal resolution rendered by the game. There are unused resolution presets in the game data that you can enable using this option.\n\"DontChange\" makes no changes - vanilla is 860x520, but this setting is also compatible with other resolution mods.\n\"Low\" is 620x350. \"High\" is 970x580.");
			restoreFilmGrain = configFile.Bind<FilmGrains>("Visual", "RestoreFilmGrain", FilmGrains.None, "Restores film grain effects from pre-release versions of the game. WARNING: Be aware that this might cause white screens on certain hardware.");
			showApparatusValue = configFile.Bind<bool>("Visual", "ShowApparatusValue", false, "Actually show the apparatus' value on the scanner instead of \"???\" (in vanilla, it is always $80)");
			disableLODFade = configFile.Bind<bool>("Visual", "DisableLODFade", true, "Disables level-of-detail cross-fading, which is broken in vanilla. This does not prevent \"pop in\" (when moving towards/away from objects) from occurring, but makes it happen only once instead of twice.");
			playermodelPatches = configFile.Bind<bool>("Visual", "PlayermodelPatches", true, "Fixes some issues with dead bodies not displaying badges, using the wrong suit, not having attachments (bee and bunny), etc.\nIf you use ModelReplacementAPI I would strongly suggest disabling this if you run into issues!");
		}

		private static void AudioConfig()
		{
			musicDopplerLevel = configFile.Bind<MusicDopplerLevel>("Audio", "MusicDopplerLevel", MusicDopplerLevel.Reduced, "Controls how much Unity's simulated \"Doppler effect\" applies to music sources like the dropship, boombox, etc. (This is what causes pitch distortion when moving towards/away from the source of the music)\n\"Vanilla\" makes no changes. \"Reduced\" will make the effect more subtle. \"None\" will disable it completely (so music always plays at the correct pitch)");
			restoreArtificeAmbience = configFile.Bind<bool>("Audio", "RestoreArtificeAmbience", true, "Restores the unique night-time ambience on Artifice, which is broken and doesn't play in vanilla.");
		}

		private static void ExtraConfig()
		{
			charredBodies = configFile.Bind<bool>("Extra", "CharredBodies", true, "When a player dies to any sort of explosion, their corpse will appear burnt, much like Cruiser explosions. (This also applies to electrocution from the electric chair.) \"PlayermodelPatches\" is *required* for this to work!");
			scanImprovements = configFile.Bind<bool>("Extra", "ScanImprovements", false, "Allows the \"scan\" command on the terminal to count the value of items on your ship in orbit. Butlers' knives will be visible on the map and \"scan\" command before they are killed.");
			lockInTerminal = configFile.Bind<bool>("Extra", "LockInTerminal", false, "The camera will be frozen when you use the terminal, and typing should be more immediately responsive.\nThis will also lock the camera when charging items, pulling the lever, or sitting in the sofa chair.");
			filterDecor = configFile.Bind<bool>("Extra", "FilterDecor", false, "Decorations (suits, furniture, etc.) you have already purchased will be filtered out of the shop's list on the terminal, potentially allowing you to see the unused \"[No items available]\" text.\nAlso corrects some inconsistent formatting, like missing bullet points and \"Price:\" text for the decor list.");
			typeGordion = configFile.Bind<bool>("Extra", "TypeGordion", false, "You can type \"Gordion\" into the terminal (in place of \"company\") when using the route/info commands.");
			alterBestiary = configFile.Bind<bool>("Extra", "AlterBestiary", false, "Restores some removed text and corrects certain typographical errors in bestiary entries.");
			adjustCooldowns = configFile.Bind<bool>("Extra", "AdjustCooldowns", true, "Changes the cooldown on some items and interactable furniture to prevent sounds overlapping in strange ways.");
			noBodyNoSignal = configFile.Bind<bool>("Extra", "NoBodyNoSignal", false, "When a player's corpse is completely destroyed (eaten by a Forest Keeper, suffocated by quicksand, etc.) the radar will display the \"No signal!\" screen instead of spectating the location where they died.");
			theGoldenGoblet = configFile.Bind<bool>("Extra", "TheGoldenGoblet", false, "Fixes Zeekerss' blatant typo when spelling \"Golden goblet\" (which, for reasons unknown, mistakenly became \"Golden cup\")");
		}

		private static void MigrateLegacyConfigs()
		{
			configFile.Bind<bool>("Gameplay", "KillOldBirds", true, "Legacy setting, doesn't work");
			configFile.Remove(configFile["Gameplay", "KillOldBirds"].Definition);
			configFile.Bind<bool>("Visual", "FancyEntranceDoors", false, "Legacy setting, use \"Chameleon\" instead");
			configFile.Remove(configFile["Visual", "FancyEntranceDoors"].Definition);
			if (!scanImprovements.Value)
			{
				if (configFile.Bind<bool>("Extra", "ScanOnShip", false, "Legacy setting, doesn't work").Value)
				{
					scanImprovements.Value = true;
				}
				configFile.Remove(configFile["Extra", "ScanOnShip"].Definition);
			}
			configFile.Bind<bool>("Visual", "RestoreShipIcon", true, "Legacy setting, doesn't work");
			configFile.Remove(configFile["Visual", "RestoreShipIcon"].Definition);
			if (fixSurfacePrices.Value)
			{
				if (!configFile.Bind<bool>("Gameplay", "FixHivePrices", true, "Legacy setting, doesn't work").Value)
				{
					fixSurfacePrices.Value = false;
				}
				configFile.Remove(configFile["Gameplay", "FixHivePrices"].Definition);
			}
			configFile.Bind<bool>("Gameplay", "LimitSpawnChance", false, "Legacy setting, use \"SpawnCycleFixes\" instead");
			configFile.Remove(configFile["Gameplay", "LimitSpawnChance"].Definition);
			configFile.Bind<bool>("Gameplay", "UnlimitedOldBirds", false, "Legacy setting, use \"SpawnCycleFixes\" instead");
			configFile.Remove(configFile["Gameplay", "UnlimitedOldBirds"].Definition);
			configFile.Bind<bool>("Gameplay", "MaskHornetsPower", false, "Legacy setting, use \"MaskHornetsPower\" instead");
			configFile.Remove(configFile["Gameplay", "MaskHornetsPower"].Definition);
			configFile.Save();
		}
	}
	internal static class LobbyCompatibility
	{
		internal static void Init()
		{
			PluginHelper.RegisterPlugin("butterystancakes.lethalcompany.butteryfixes", Version.Parse("1.16.3"), (CompatibilityLevel)0, (VersionStrictness)0);
		}
	}
	[BepInPlugin("butterystancakes.lethalcompany.butteryfixes", "Buttery Fixes", "1.16.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal const string PLUGIN_GUID = "butterystancakes.lethalcompany.butteryfixes";

		internal const string PLUGIN_NAME = "Buttery Fixes";

		internal const string PLUGIN_VERSION = "1.16.3";

		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			Compatibility.Init();
			Configuration.Init(((BaseUnityPlugin)this).Config);
			if (RestoreFilmGrain.GetTextures())
			{
				SceneManager.sceneLoaded += RestoreFilmGrain.OverrideVolumes;
			}
			new Harmony("butterystancakes.lethalcompany.butteryfixes").PatchAll();
			SceneManager.sceneLoaded += SceneOverrides.OnSceneLoaded;
			SceneManager.sceneUnloaded += delegate
			{
				GlobalReferences.caveTiles.Clear();
			};
			RenderPipelineManager.beginCameraRendering += RenderingOverrides.OnBeginCameraRendering;
			RenderPipelineManager.endCameraRendering += RenderingOverrides.OnEndCameraRendering;
			Logger.LogInfo((object)"Buttery Fixes v1.16.3 loaded");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ButteryFixes";

		public const string PLUGIN_NAME = "ButteryFixes";

		public const string PLUGIN_VERSION = "1.16.3";
	}
}
namespace ButteryFixes.Utility
{
	internal class ButlerRadar
	{
		internal class RadarButler
		{
			internal ButlerEnemyAI butler;

			internal Transform radarIcon;

			internal Transform knife;

			internal bool dying;
		}

		[CompilerGenerated]
		private sealed class <ButlerDeathAnimation>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public RadarButler butler;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1.1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (butler == null)
					{
						return false;
					}
					break;
				case 2:
					<>1__state = -1;
					break;
				}
				if (butler != null && !((EnemyAI)butler.butler).creatureAnimator.GetBool("popFinish"))
				{
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				if (butler != null)
				{
					if ((Object)(object)butler.radarIcon != (Object)null)
					{
						Object.Destroy((Object)(object)((Component)butler.radarIcon).gameObject);
					}
					allButlers.Remove(butler);
					Plugin.Logger.LogDebug((object)$"Radar: Butler #{((Object)butler.butler).GetInstanceID()} dropped knife");
				}
				return false;
			}

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

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

		private static List<RadarButler> allButlers = new List<RadarButler>(7);

		internal static void SpawnButler(ButlerEnemyAI butler)
		{
			List<RadarButler> list = allButlers;
			RadarButler obj = new RadarButler
			{
				butler = butler
			};
			GameObject itemRadarIconPrefab = StartOfRound.Instance.itemRadarIconPrefab;
			GameObject mapPropsContainer = RoundManager.Instance.mapPropsContainer;
			obj.radarIcon = Object.Instantiate<GameObject>(itemRadarIconPrefab, (mapPropsContainer != null) ? mapPropsContainer.transform : null).transform;
			obj.knife = ((Component)((EnemyAI)butler).creatureAnimator).transform.Find("Rig 1/Arms/RightArm/upperRightArmContainer/upper_arm.R_target/Knife");
			list.Add(obj);
			Plugin.Logger.LogDebug((object)$"Radar: Butler #{((Object)butler).GetInstanceID()} registered");
		}

		internal static void ClearAllButlers()
		{
			if (allButlers.Count < 1)
			{
				return;
			}
			for (int num = allButlers.Count - 1; num >= 0; num--)
			{
				if ((Object)(object)allButlers[num]?.radarIcon != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)allButlers[num].radarIcon).gameObject);
				}
			}
			allButlers.Clear();
			Plugin.Logger.LogDebug((object)"Radar: No more butlers");
		}

		internal static void UpdateButlers()
		{
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			if (allButlers.Count < 1)
			{
				return;
			}
			for (int num = allButlers.Count - 1; num >= 0; num--)
			{
				if (allButlers[num] == null || (Object)(object)allButlers[num].radarIcon == (Object)null)
				{
					allButlers.RemoveAt(num);
					Plugin.Logger.LogDebug((object)$"Radar: Butler at index {num} is missing, this shouldn't happen");
				}
				else if (((EnemyAI)allButlers[num].butler).isEnemyDead)
				{
					if (!allButlers[num].dying)
					{
						allButlers[num].dying = true;
						((MonoBehaviour)StartOfRound.Instance).StartCoroutine(ButlerDeathAnimation(allButlers[num]));
						allButlers[num].radarIcon.position = ((Component)allButlers[num].butler).transform.position + Vector3.up * 0.5f;
						Plugin.Logger.LogDebug((object)$"Radar: Butler #{((Object)allButlers[num].butler).GetInstanceID()} just died");
					}
				}
				else
				{
					Vector3 position = allButlers[num].knife.position;
					if (allButlers[num].knife.localScale.x < 0.025f)
					{
						position.x = ((Component)allButlers[num].butler).transform.position.x;
						position.z = ((Component)allButlers[num].butler).transform.position.z;
					}
					allButlers[num].radarIcon.position = position;
				}
			}
		}

		[IteratorStateMachine(typeof(<ButlerDeathAnimation>d__5))]
		private static IEnumerator ButlerDeathAnimation(RadarButler butler)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ButlerDeathAnimation>d__5(0)
			{
				butler = butler
			};
		}

		internal static int CountButlers()
		{
			return allButlers.Count;
		}
	}
	internal static class GlobalReferences
	{
		internal const int NUM_LEVELS = 13;

		private static Terminal _terminal;

		private static HangarShipDoor hangarShipDoor;

		private static StartMatchLever startMatchLever;

		internal static Dictionary<string, EnemyType> allEnemiesList = new Dictionary<string, EnemyType>();

		internal static float dopplerLevelMult = 1f;

		internal static Mesh playerBody;

		internal static Material scavengerSuitBurnt;

		internal static bool crashedJetpackAsLocalPlayer;

		internal static GameObject smokeParticle;

		internal static Transform shipNode;

		internal static Vector3 shipNodeOffset;

		internal static readonly Vector3 shipDefaultPos = new Vector3(1.2714634f, 0.27843857f, -7.5f);

		internal static bool patchScanNodes;

		internal static int scrapNotCollected = -1;

		internal static int scrapEaten;

		internal static Animator shipAnimator;

		internal static VehicleController vehicleController;

		internal static int lockingCamera;

		internal static bool sittingInArmchair;

		internal static PlayerControllerB friedPlayer;

		internal static PlayerControllerB gibbedPlayer;

		internal static List<Bounds> caveTiles = new List<Bounds>();

		internal static Vector3 mainEntrancePos;

		internal static Bounds mineStartBounds;

		internal static Renderer viewmodelArms;

		internal static Camera shipCamera;

		internal static Camera securityCamera;

		internal static List<GrabbableObject> microwavedItems = new List<GrabbableObject>();

		internal static PlayerControllerB lastDriver;

		internal static Vector3 lastLightningStrike = new Vector3(3000f, 0f, 3000f);

		internal static float lightningLastStruck;

		internal static Terminal Terminal
		{
			get
			{
				if ((Object)(object)_terminal == (Object)null)
				{
					_terminal = Object.FindAnyObjectByType<Terminal>();
				}
				return _terminal;
			}
		}

		internal static HangarShipDoor HangarShipDoor
		{
			get
			{
				if ((Object)(object)hangarShipDoor == (Object)null)
				{
					hangarShipDoor = Object.FindAnyObjectByType<HangarShipDoor>();
				}
				return hangarShipDoor;
			}
		}

		internal static StartMatchLever StartMatchLever
		{
			get
			{
				if ((Object)(object)startMatchLever == (Object)null)
				{
					startMatchLever = Object.FindAnyObjectByType<StartMatchLever>();
				}
				return startMatchLever;
			}
		}
	}
	internal class HeartHack : MonoBehaviour
	{
		internal LoopShapeKey loopShapeKey;

		private float time;

		private void LateUpdate()
		{
			if ((Object)(object)loopShapeKey != (Object)null)
			{
				time += Time.deltaTime * loopShapeKey.fearMultiplier;
				if ((Object)(object)loopShapeKey.skinnedMeshRenderer != (Object)null && ((Behaviour)loopShapeKey).enabled)
				{
					loopShapeKey.skinnedMeshRenderer.SetBlendShapeWeight(0, Mathf.PingPong(time * 156f, 100f));
					loopShapeKey.skinnedMeshRenderer.SetBlendShapeWeight(1, Mathf.PingPong(time * 120f, 100f));
				}
			}
			else
			{
				loopShapeKey = ((Component)this).GetComponent<LoopShapeKey>();
				if ((Object)(object)loopShapeKey == (Object)null)
				{
					Plugin.Logger.LogWarning((object)("Error initializing heartbeat animation for " + ((Object)this).name));
					((Behaviour)this).enabled = false;
				}
			}
		}
	}
	public static class NonPatchFunctions
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0
		{
			public ShotgunItem shotgun;

			public float timeSinceStart;

			internal bool <ShellsAppearAfterDelay>b__0()
			{
				if (shotgun.isReloading)
				{
					return Time.realtimeSinceStartup - timeSinceStart > 3f;
				}
				return true;
			}
		}

		[CompilerGenerated]
		private sealed class <InteractionTemporarilyLocksCamera>d__8 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public InteractTrigger trigger;

			private float <startTime>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if ((Object)(object)trigger == (Object)null)
					{
						return false;
					}
					<startTime>5__2 = Time.realtimeSinceStartup;
					goto IL_0056;
				case 1:
					<>1__state = -1;
					goto IL_0056;
				case 2:
					{
						<>1__state = -1;
						if (GlobalReferences.lockingCamera > 0)
						{
							GlobalReferences.lockingCamera--;
						}
						return false;
					}
					IL_0056:
					if ((Object)(object)trigger.playerScriptInSpecialAnimation != (Object)(object)GameNetworkManager.Instance.localPlayerController && Time.realtimeSinceStartup - <startTime>5__2 < 2f)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					if ((Object)(object)trigger.playerScriptInSpecialAnimation != (Object)(object)GameNetworkManager.Instance.localPlayerController)
					{
						Plugin.Logger.LogDebug((object)"Failed to lock animation for local player, who never entered animation state");
						return false;
					}
					GlobalReferences.lockingCamera++;
					<>2__current = (object)new WaitForSeconds(trigger.animationWaitTime);
					<>1__state = 2;
					return true;
				}
			}

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

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

		[CompilerGenerated]
		private sealed class <LightningShakesBody>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public DeadBodyInfo deadBodyInfo;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (Time.realtimeSinceStartup - GlobalReferences.lightningLastStruck <= 2f && (Object)(object)deadBodyInfo?.playerScript != (Object)null && Vector3.Distance(GlobalReferences.lastLightningStrike, deadBodyInfo.playerScript.positionOfDeath) <= 7f)
					{
						Plugin.Logger.LogDebug((object)("Player \"" + deadBodyInfo.playerScript.playerUsername + "\" was likely struck by lightning, shake rigidbodies"));
						ShakeRigidbodies obj = ((Component)deadBodyInfo).gameObject.AddComponent<ShakeRigidbodies>();
						obj.rigidBodies = (from rb in ((Component)deadBodyInfo).GetComponentsInChildren<Rigidbody>()
							where ((Component)rb).gameObject.layer == 20 && !((Object)rb).name.EndsWith("lower") && !((Object)rb).name.StartsWith("shin")
							select rb).ToArray();
						obj.shakeTimer = 5f;
						obj.shakeIntensity = 4755f;
					}
					return false;
				}
			}

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

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

		[CompilerGenerated]
		private sealed class <ShellsAppearAfterDelay>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ShotgunItem shotgun;

			private <>c__DisplayClass2_0 <>8__1;

			private bool <wasHeldByEnemy>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01af: Expected O, but got Unknown
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Expected O, but got Unknown
				//IL_0171: Unknown result type (might be due to invalid IL or missing references)
				//IL_017b: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass2_0();
					<>8__1.shotgun = shotgun;
					<wasHeldByEnemy>5__2 = ((GrabbableObject)<>8__1.shotgun).isHeldByEnemy;
					<>8__1.timeSinceStart = Time.realtimeSinceStartup;
					<>2__current = (object)new WaitForSeconds(((GrabbableObject)<>8__1.shotgun).isHeldByEnemy ? 0.85f : 1.9f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (((GrabbableObject)<>8__1.shotgun).isHeldByEnemy)
					{
						((Renderer)<>8__1.shotgun.shotgunShellLeft).forceRenderingOff = false;
						((Renderer)<>8__1.shotgun.shotgunShellLeft).enabled = true;
						((Renderer)<>8__1.shotgun.shotgunShellRight).forceRenderingOff = false;
						((Renderer)<>8__1.shotgun.shotgunShellRight).enabled = true;
					}
					else if (((Renderer)<>8__1.shotgun.shotgunShellLeft).enabled)
					{
						((Renderer)<>8__1.shotgun.shotgunShellRight).enabled = true;
					}
					else
					{
						((Renderer)<>8__1.shotgun.shotgunShellLeft).enabled = true;
					}
					<>2__current = (object)new WaitForSeconds(((GrabbableObject)<>8__1.shotgun).isHeldByEnemy ? 0.66f : 0.75f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					if (!<wasHeldByEnemy>5__2)
					{
						<>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.shotgun.isReloading || Time.realtimeSinceStartup - <>8__1.timeSinceStart > 3f));
						<>1__state = 3;
						return true;
					}
					break;
				case 3:
					<>1__state = -1;
					break;
				}
				((Renderer)<>8__1.shotgun.shotgunShellLeft).forceRenderingOff = true;
				((Renderer)<>8__1.shotgun.shotgunShellRight).forceRenderingOff = true;
				Plugin.Logger.LogDebug((object)$"Finished animating shotgun shells (held by enemy: {((GrabbableObject)<>8__1.shotgun).isHeldByEnemy})");
				return false;
			}

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

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

		[CompilerGenerated]
		private sealed class <TryAutoCollectBody>d__14 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public DeadBodyInfo deadBodyInfo;

			private float <timeOfDeath>5__2;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<timeOfDeath>5__2 = Time.realtimeSinceStartup;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (Time.realtimeSinceStartup - <timeOfDeath>5__2 <= 2f && (Object)(object)deadBodyInfo?.grabBodyObject == (Object)null)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if ((Object)(object)deadBodyInfo != (Object)null && !deadBodyInfo.deactivated && (Object)(object)deadBodyInfo.grabBodyObject != (Object)null && !deadBodyInfo.grabBodyObject.deactivated && (Object)(object)deadBodyInfo.playerScript != (Object)null)
				{
					deadBodyInfo.playerScript.SetItemInElevator(true, true, deadBodyInfo.grabBodyObject);
					Plugin.Logger.LogDebug((object)("Player \"" + deadBodyInfo.playerScript?.playerUsername + "\" automatically collected themself"));
				}
				return false;
			}

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

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

		internal static bool[] playerWasLastSprinting = new bool[50];

		internal static int hives;

		[IteratorStateMachine(typeof(<ShellsAppearAfterDelay>d__2))]
		internal static IEnumerator ShellsAppearAfterDelay(ShotgunItem shotgun)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ShellsAppearAfterDelay>d__2(0)
			{
				shotgun = shotgun
			};
		}

		internal static void FakeFootstepAlert(PlayerControllerB player)
		{
			//IL_0077: 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)
			bool flag = player.isInHangarShipRoom && StartOfRound.Instance.hangarDoorsClosed;
			if ((int)player.actualClientId < playerWasLastSprinting.Length && (((NetworkBehaviour)player).IsOwner ? player.isSprinting : playerWasLastSprinting[(uint)player.actualClientId]))
			{
				RoundManager.Instance.PlayAudibleNoise(((Component)player).transform.position, 22f, 0.6f, 0, flag, 3322);
			}
			else
			{
				RoundManager.Instance.PlayAudibleNoise(((Component)player).transform.position, 17f, 0.4f, 0, flag, 3322);
			}
		}

		internal static void ForceRefreshAllHelmetLights(PlayerControllerB player, bool forceOff = false)
		{
			for (int i = 0; i < player.allHelmetLights.Length; i++)
			{
				bool flag = false;
				if (!forceOff)
				{
					for (int j = 0; j < player.ItemSlots.Length; j++)
					{
						if ((Object)(object)player.ItemSlots[j] != (Object)null)
						{
							GrabbableObject obj = player.ItemSlots[j];
							FlashlightItem val = (FlashlightItem)(object)((obj is FlashlightItem) ? obj : null);
							if ((Object)(object)val != (Object)null && val.flashlightTypeID == i && ((GrabbableObject)val).isPocketed && ((GrabbableObject)val).isBeingUsed && ((GrabbableObject)val).insertedBattery.charge > 0f)
							{
								flag = true;
								break;
							}
						}
					}
				}
				if (((Behaviour)player.allHelmetLights[i]).enabled != flag)
				{
					((Behaviour)player.allHelmetLights[i]).enabled = flag;
					Plugin.Logger.LogDebug((object)$"Fixed erroneous active state of {player.playerUsername}'s helmet light \"{((Object)player.allHelmetLights[i]).name}\" (now {flag})");
				}
			}
		}

		internal static void SmokingHotCorpse(Transform body)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			SkinnedMeshRenderer skinnedMeshRenderer = default(SkinnedMeshRenderer);
			if ((Object)(object)GlobalReferences.smokeParticle == (Object)null || !((Component)body).TryGetComponent<SkinnedMeshRenderer>(ref skinnedMeshRenderer))
			{
				return;
			}
			foreach (Transform item in body)
			{
				if (((Object)item).name.StartsWith(((Object)GlobalReferences.smokeParticle).name))
				{
					return;
				}
			}
			GameObject obj = Object.Instantiate<GameObject>(GlobalReferences.smokeParticle, ((Component)body).transform);
			obj.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
			obj.transform.localScale = Vector3.one;
			ShapeModule shape = obj.GetComponent<ParticleSystem>().shape;
			((ShapeModule)(ref shape)).skinnedMeshRenderer = skinnedMeshRenderer;
			Plugin.Logger.LogDebug((object)"Smoke from freshly burnt corpse");
		}

		public static void BabyEatsScrap(GrabbableObject grabObj)
		{
			if (grabObj.itemProperties.isScrap)
			{
				GlobalReferences.scrapEaten += grabObj.scrapValue;
			}
		}

		public static int RerollHivePrice(int price, Vector3 pos)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			hives++;
			if (!Configuration.fixSurfacePrices.Value || StartOfRound.Instance.isChallengeFile)
			{
				return price;
			}
			Random random = new Random(StartOfRound.Instance.randomMapSeed + 1314 + hives);
			int num = random.Next(50, 150);
			if (Vector3.Distance(pos, StartOfRound.Instance.shipLandingPosition.position) < 40f)
			{
				num = random.Next(40, 100);
			}
			Plugin.Logger.LogDebug((object)$"Hive price recalculated: ${price} -> ${num}");
			return num;
		}

		[IteratorStateMachine(typeof(<InteractionTemporarilyLocksCamera>d__8))]
		internal static IEnumerator InteractionTemporarilyLocksCamera(InteractTrigger trigger)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <InteractionTemporarilyLocksCamera>d__8(0)
			{
				trigger = trigger
			};
		}

		internal static void TestForVainShrouds()
		{
			if (Compatibility.ENABLE_VAIN_SHROUDS || (Object)(object)StartOfRound.Instance == (Object)null)
			{
				return;
			}
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				if (val.moldSpreadIterations > 0 && val.canSpawnMold)
				{
					Compatibility.ENABLE_VAIN_SHROUDS = true;
					Plugin.Logger.LogInfo((object)"YesFox is not installed, but current save file still has Vain Shrouds");
					break;
				}
			}
		}

		public static Vector3 GetTrueExitPoint(bool ignore = true, bool ignore2 = false)
		{
			//IL_006d: 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_003d: 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_004c: 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)
			if (RoundManager.Instance.currentDungeonType == 4 && (Object)(object)RoundManager.Instance.currentMineshaftElevator != (Object)null && !((Bounds)(ref GlobalReferences.mineStartBounds)).Contains(((Component)StartOfRound.Instance.mapScreen.mapCamera).transform.position - Vector3.up * 3.75f))
			{
				return RoundManager.Instance.currentMineshaftElevator.elevatorBottomPoint.position;
			}
			return GlobalReferences.mainEntrancePos;
		}

		internal static void ClearMicrowave()
		{
			for (int i = 0; i < GlobalReferences.microwavedItems.Count; i++)
			{
				if (!((Object)(object)GlobalReferences.microwavedItems[i] == (Object)null))
				{
					GlobalReferences.microwavedItems[i].rotateObject = false;
				}
			}
			GlobalReferences.microwavedItems.Clear();
		}

		public static PlayerControllerB CruiserCreditsPlayer()
		{
			if ((Object)(object)GlobalReferences.lastDriver != (Object)null)
			{
				return GlobalReferences.lastDriver;
			}
			return GameNetworkManager.Instance.localPlayerController;
		}

		[IteratorStateMachine(typeof(<LightningShakesBody>d__13))]
		internal static IEnumerator LightningShakesBody(DeadBodyInfo deadBodyInfo)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LightningShakesBody>d__13(0)
			{
				deadBodyInfo = deadBodyInfo
			};
		}

		[IteratorStateMachine(typeof(<TryAutoCollectBody>d__14))]
		internal static IEnumerator TryAutoCollectBody(DeadBodyInfo deadBodyInfo)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TryAutoCollectBody>d__14(0)
			{
				deadBodyInfo = deadBodyInfo
			};
		}
	}
	internal class PlayerGibsLinker : MonoBehaviour
	{
		private void Start()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: 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_0136: 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)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: 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_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)GlobalReferences.gibbedPlayer != (Object)null))
			{
				return;
			}
			if (Configuration.playermodelPatches.Value)
			{
				UnlockableItem val = StartOfRound.Instance.unlockablesList.unlockables[GlobalReferences.gibbedPlayer.currentSuitID];
				Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>();
				foreach (Renderer val2 in componentsInChildren)
				{
					if (((Object)val2).name == "Head (2)")
					{
						val2.sharedMaterial = val.suitMaterial;
						if ((Object)(object)val.headCostumeObject != (Object)null)
						{
							Transform transform = Object.Instantiate<GameObject>(val.headCostumeObject, ((Component)val2).transform.position, ((Component)val2).transform.rotation, ((Component)val2).transform).transform;
							((Component)transform).transform.SetLocalPositionAndRotation(new Vector3(0.06989373f, 0.0544735f, -0.6852454f), Quaternion.Euler(96.69699f, 0f, 0f));
							((Component)transform).transform.localScale = new Vector3(((Component)transform).transform.localScale.x / ((Component)val2).transform.lossyScale.x, ((Component)transform).transform.localScale.y / ((Component)val2).transform.lossyScale.y, ((Component)transform).transform.localScale.z / ((Component)val2).transform.lossyScale.z) * 0.9f;
						}
					}
					else if (val2 is SkinnedMeshRenderer)
					{
						val2.sharedMaterials = (Material[])(object)new Material[2]
						{
							val.suitMaterial,
							val2.sharedMaterials[1]
						};
						if (((Object)val2).name == "RendedBodyTorsoMesh" && (Object)(object)val.lowerTorsoCostumeObject != (Object)null)
						{
							Transform transform2 = Object.Instantiate<GameObject>(val.lowerTorsoCostumeObject, ((Component)val2).transform.position, ((Component)val2).transform.rotation, ((Component)val2).transform).transform;
							((Component)transform2).transform.SetLocalPositionAndRotation(new Vector3(0.55988234f, -0.046097063f, -5.0041165f), Quaternion.Euler(88.184f, -51.554f, -51.067f));
							((Component)transform2).transform.localScale = new Vector3(((Component)transform2).transform.localScale.x / ((Component)val2).transform.lossyScale.x, ((Component)transform2).transform.localScale.y / ((Component)val2).transform.lossyScale.y, ((Component)transform2).transform.localScale.z / ((Component)val2).transform.lossyScale.z);
						}
					}
				}
				Plugin.Logger.LogDebug((object)("Apply suit to " + GlobalReferences.gibbedPlayer.playerUsername + "'s gibs"));
			}
			GlobalReferences.gibbedPlayer = null;
		}
	}
	internal static class ReflectionCache
	{
		internal static readonly FieldInfo IS_IN_HANGAR_SHIP_ROOM = AccessTools.Field(typeof(PlayerControllerB), "isInHangarShipRoom");

		internal static FieldInfo VEHICLE_CONTROLLER = AccessTools.Field(typeof(GlobalReferences), "vehicleController");
	}
	internal static class RenderingOverrides
	{
		private static bool? armsNotRendering;

		public static void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera)
		{
			ResetRendering();
			if ((Object)(object)GlobalReferences.viewmodelArms == (Object)null)
			{
				armsNotRendering = null;
			}
			else if ((Object)(object)camera == (Object)(object)GlobalReferences.shipCamera || (Object)(object)camera == (Object)(object)GlobalReferences.securityCamera)
			{
				armsNotRendering = GlobalReferences.viewmodelArms.forceRenderingOff;
				GlobalReferences.viewmodelArms.forceRenderingOff = true;
			}
		}

		public static void OnEndCameraRendering(ScriptableRenderContext context, Camera camera)
		{
			ResetRendering();
		}

		private static void ResetRendering()
		{
			if (armsNotRendering.HasValue && (Object)(object)GlobalReferences.viewmodelArms != (Object)null)
			{
				GlobalReferences.viewmodelArms.forceRenderingOff = armsNotRendering.Value;
				armsNotRendering = null;
			}
		}
	}
	internal class RestoreFilmGrain
	{
		private static Texture scanline;

		private static Texture scanlineBlue;

		internal static bool GetTextures()
		{
			try
			{
				AssetBundle obj = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "filmgrain"));
				scanline = obj.LoadAsset<Texture>("scanline");
				scanlineBlue = obj.LoadAsset<Texture>("scanlineBlue");
				obj.Unload(false);
				return true;
			}
			catch
			{
				Plugin.Logger.LogError((object)"Encountered some error loading assets from bundle \"filmgrain\". Did you install the plugin correctly?");
				return false;
			}
		}

		internal static void OverrideVolumes(Scene scene, LoadSceneMode mode)
		{
			if (Configuration.restoreFilmGrain.Value == FilmGrains.None || (Object)(object)scanline == (Object)null || (Object)(object)scanlineBlue == (Object)null)
			{
				return;
			}
			Volume[] array = Object.FindObjectsByType<Volume>((FindObjectsInactive)1, (FindObjectsSortMode)0);
			Bloom val2 = default(Bloom);
			foreach (Volume val in array)
			{
				if (((Object)val.sharedProfile).name != "UIEffects" && Configuration.restoreFilmGrain.Value == FilmGrains.MenusOnly)
				{
					continue;
				}
				switch (((Object)val.sharedProfile).name)
				{
				case "UIEffects":
					ApplyFilmGrain(val.sharedProfile, 0.085f, 0.06f, scanline, (FilmGrainLookup)10);
					val.sharedProfile.TryGet<Bloom>(ref val2);
					if ((Object)(object)val2 != (Object)null)
					{
						((VolumeComponent)val2).active = true;
						Plugin.Logger.LogDebug((object)("Bloom: " + ((Object)val.sharedProfile).name));
					}
					break;
				case "IngameHUD":
					ApplyFilmGrain(val.sharedProfile, 0f, 0.49f, scanline, (FilmGrainLookup)10);
					break;
				case "FlashbangedFilter":
					ApplyFilmGrain(val.sharedProfile, 1f, 0.818f, null, (FilmGrainLookup)9);
					break;
				case "InsanityVolume":
					ApplyFilmGrain(val.sharedProfile, 0.374f, 0.558f, null, (FilmGrainLookup)9);
					break;
				case "WakeUpVolume":
					ApplyFilmGrain(val.sharedProfile, 0.112f, 0.524f, scanline, (FilmGrainLookup)10);
					break;
				case "ScanVolume":
					ApplyFilmGrain(val.sharedProfile, 0.073f, 0.49f, scanlineBlue, (FilmGrainLookup)10);
					break;
				}
			}
		}

		private static void ApplyFilmGrain(VolumeProfile profile, float intensity, float response, Texture texture = null, FilmGrainLookup type = 10)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			FilmGrain val = default(FilmGrain);
			profile.TryGet<FilmGrain>(ref val);
			if ((Object)(object)val == (Object)null)
			{
				val = profile.Add<FilmGrain>(false);
			}
			if ((Object)(object)texture != (Object)null)
			{
				((VolumeParameter<Texture>)(object)val.texture).Override(texture);
				((VolumeParameter<FilmGrainLookup>)(object)val.type).Override((FilmGrainLookup)10);
			}
			else
			{
				((VolumeParameter<FilmGrainLookup>)(object)val.type).Override(type);
			}
			((VolumeParameter<float>)(object)val.intensity).Override(intensity);
			((VolumeParameter<float>)(object)val.response).Override(response);
			if (((Object)profile).name == "InsanityVolume")
			{
				((VolumeParameter)val.response).overrideState = false;
			}
			Plugin.Logger.LogDebug((object)("Film grain: " + ((Object)profile).name));
		}
	}
	internal static class SceneOverrides
	{
		internal static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_089c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0705: Unknown result type (might be due to invalid IL or missing references)
			//IL_0711: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Unknown result type (might be due to invalid IL or missing references)
			//IL_073e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0748: Unknown result type (might be due to invalid IL or missing references)
			//IL_0752: Unknown result type (might be due to invalid IL or missing references)
			//IL_075f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a86: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0951: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_081e: Unknown result type (might be due to invalid IL or missing references)
			//IL_082d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0840: Unknown result type (might be due to invalid IL or missing references)
			//IL_084c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0856: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dcc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ddb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c45: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c4c: Expected O, but got Unknown
			//IL_09d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			if ((int)mode != 1)
			{
				return;
			}
			bool flag = Configuration.fixFireExits.Value;
			GameObject obj = GameObject.Find("/Environment/Map/DiageticAmbiance/BigMachine");
			Transform val = ((obj != null) ? obj.transform : null);
			List<string> list = new List<string>();
			switch (((Scene)(ref scene)).name)
			{
			case "Level1Experimentation":
			{
				Plugin.Logger.LogDebug((object)"Detected landing on Experimentation");
				if ((Object)(object)val != (Object)null)
				{
					val.localPosition = new Vector3(-96.45731f, val.localPosition.y, val.localPosition.z);
					Plugin.Logger.LogDebug((object)"Experimentation - Fixed factory ambience");
				}
				GameObject obj3 = GameObject.Find("/Environment/ReverbTriggers (1)/Cube (7)");
				Transform val4 = ((obj3 != null) ? obj3.transform : null);
				if ((Object)(object)val4 != (Object)null)
				{
					val4.localPosition = new Vector3(-147.8f, val4.localPosition.y, -81.2f);
					val4.localScale = new Vector3(129.6264f, val4.localScale.y, 184.7249f);
					GameObject obj4 = GameObject.Find("/Environment/ReverbTriggers (1)/Cube (9)");
					Transform val5 = ((obj4 != null) ? obj4.transform : null);
					if ((Object)(object)val5 != (Object)null)
					{
						val5.localPosition = new Vector3(-145.4f, val5.localPosition.y, -42.1f);
						val5.localScale = new Vector3(171.2598f, val5.localScale.y, 326.2066f);
						GameObject obj5 = GameObject.Find("/Environment/ReverbTriggers (1)/Cube (8)");
						Transform val6 = ((obj5 != null) ? obj5.transform : null);
						if ((Object)(object)val6 != (Object)null)
						{
							val6.localPosition = new Vector3(-117.39f, val6.localPosition.y, -87.23f);
							val6.localScale = new Vector3(10.4316f, val6.localScale.y, 15.95104f);
							Plugin.Logger.LogDebug((object)"Experimentation - Adjusted water tower fog triggers");
						}
					}
				}
				GameObject obj6 = GameObject.Find("/Environment/SteelDoor");
				Transform val7 = ((obj6 != null) ? obj6.transform : null);
				if ((Object)(object)val7 != (Object)null)
				{
					val7.localPosition = new Vector3(-194.668f, 19.788f, val7.localPosition.z);
					Transform obj7 = val7.Find("DoorMesh/Cube");
					InteractTrigger val8 = ((obj7 != null) ? ((Component)obj7).GetComponent<InteractTrigger>() : null);
					if ((Object)(object)val8 != (Object)null)
					{
						val8.hoverTip = val8.hoverTip.Replace("[ LMB ]", "[LMB]");
					}
					Plugin.Logger.LogDebug((object)"Experimentation - Fixed old back entrance");
				}
				GameObject obj8 = GameObject.Find("/Environment/Map/Cube (1)");
				Renderer val9 = ((obj8 != null) ? obj8.GetComponent<Renderer>() : null);
				if ((Object)(object)val9 != (Object)null)
				{
					val9.enabled = false;
					Plugin.Logger.LogDebug((object)"Experimentation - Hide untextured geometry");
				}
				GameObject val10 = GameObject.Find("/Environment/Map/ModelsIntroScene/Cube.007/Buttresses.001");
				if ((Object)(object)val10 != (Object)null)
				{
					val10.AddComponent<MeshCollider>();
					Plugin.Logger.LogDebug((object)"Experimentation - Fix buttress collision");
				}
				list.AddRange(new <>z__ReadOnlyArray<string>(new string[40]
				{
					"BendingPipe", "Bolt", "CatwalkChunk", "CatwalkChunk.004", "CatwalkChunk.005", "CatwalkRailPost", "CatwalkStairTile", "ChainlinkFenceBend", "ChainlinkFenceCut", "CordConnector",
					"Cube.001", "Cube.004", "Cube.006", "Cube.007/HangarRoomBeams.001", "Cube.007/SiloWithLadder.001", "Girder1", "GridPlate", "LadderFrame", "LongCord1", "LongCord2",
					"LongCord3", "LongCord4", "MeterBoxDevice", "MiscShelf1", "MiscShelf2", "NurbsPath", "Pipework2", "PlayerScaleCube.001", "PlayerScaleRef", "PlayerScaleRef.001",
					"RaisedCementPlatform", "Scaffolding", "SiloTall", "SpawnRoom", "StandardDoorSize", "StandardDoorSize.001", "StandardDoorSize.002", "TelephonePoleCordsC", "TrainCarRailLowDetail", "ValveWithHandle.001"
				}));
				break;
			}
			case "Level2Assurance":
				Plugin.Logger.LogDebug((object)"Detected landing on Assurance");
				list.AddRange(new <>z__ReadOnlyArray<string>(new string[6] { "ChainlinkFenceCut", "NurbsPath", "Pipework2", "PlayerScaleCube.001", "PlayerScaleRef", "PlayerScaleRef.001" }));
				break;
			case "Level3Vow":
				Plugin.Logger.LogDebug((object)"Detected landing on Vow");
				flag = false;
				break;
			case "Level4March":
				Plugin.Logger.LogDebug((object)"Detected landing on March");
				break;
			case "Level5Rend":
			{
				Plugin.Logger.LogDebug((object)"Detected landing on Rend");
				GameObject val15 = GameObject.Find("/Environment/Map/CementFacility1/Cube.002");
				if ((Object)(object)val15 != (Object)null)
				{
					GameObject val16 = new GameObject("Cube.002 (2)");
					val16.transform.SetParent(val15.transform.parent);
					val16.transform.SetLocalPositionAndRotation(new Vector3(-24.297f, val15.transform.localPosition.y, 19.699f), val15.transform.localRotation);
					val16.transform.localScale = new Vector3(val15.transform.localScale.x, 0.655802f, val15.transform.localScale.z);
					val16.layer = val15.layer;
					val16.AddComponent<MeshFilter>().sharedMesh = val15.GetComponent<MeshCollider>().sharedMesh;
					Renderer component = val15.GetComponent<Renderer>();
					((Renderer)val16.AddComponent<MeshRenderer>()).sharedMaterial = component.sharedMaterial;
					component.enabled = false;
					Plugin.Logger.LogDebug((object)"Rend - Adjust fire exit visuals");
				}
				if ((Object)(object)val != (Object)null)
				{
					val.localPosition = new Vector3(63.55667f, -18.09991f, -139.49373f);
					Plugin.Logger.LogDebug((object)"Rend - Fixed factory ambience");
				}
				break;
			}
			case "Level6Dine":
			{
				Plugin.Logger.LogDebug((object)"Detected landing on Dine");
				GameObject obj2 = GameObject.Find("/Environment/Map/KillTrigger (4)");
				Transform val3 = ((obj2 != null) ? obj2.transform : null);
				if ((Object)(object)val3 != (Object)null)
				{
					val3.localPosition = new Vector3(148.11f, val3.localPosition.y, 83.61f);
					val3.localScale = new Vector3(35.3778f, val3.localScale.y, val3.localScale.z);
					Plugin.Logger.LogDebug((object)"Dine - Fixed death pit");
				}
				break;
			}
			case "Level7Offense":
				Plugin.Logger.LogDebug((object)"Detected landing on Offense");
				if ((Object)(object)val != (Object)null)
				{
					val.localPosition = new Vector3(27.601871f, 24.056633f, -67.70342f);
					Plugin.Logger.LogDebug((object)"Offense - Fixed factory ambience");
				}
				list.AddRange(new <>z__ReadOnlyArray<string>(new string[11]
				{
					"ChainlinkFenceCut", "CreeperVine", "MiscShelf1", "NurbsPath", "Pipework2", "PlayerScaleCube.001", "PlayerScaleRef", "PlayerScaleRef.001", "LargePipeCorner (1)", "LargePipeCorner (2)",
					"Girder1 (4)"
				}));
				break;
			case "Level8Titan":
				Plugin.Logger.LogDebug((object)"Detected landing on Titan");
				if ((Object)(object)val != (Object)null)
				{
					val.localPosition = new Vector3(-36.07f, 55.12f, 26.15f);
					Plugin.Logger.LogDebug((object)"Titan - Fixed factory ambience");
				}
				break;
			case "Level9Artifice":
			{
				Plugin.Logger.LogDebug((object)"Detected landing on Artifice");
				GameObject val12 = GameObject.Find("/Environment/Map/WarehouseV1 (2)/CircularRoofBeam");
				if ((Object)(object)val12 != (Object)null)
				{
					val12.SetActive(false);
					Plugin.Logger.LogDebug((object)"Artifice - Hide out-of-bounds objects");
				}
				GameObject obj10 = GameObject.Find("/Environment/FireExit/FireExitDoorContainer/FireExitDoor");
				Transform val13 = ((obj10 != null) ? obj10.transform : null);
				if ((Object)(object)val13 != (Object)null)
				{
					val13.localPosition = new Vector3(12.356f, val13.localPosition.y, -13.3f);
					Plugin.Logger.LogDebug((object)"Artifice - Adjust fire exit position");
				}
				if (!Configuration.restoreArtificeAmbience.Value)
				{
					break;
				}
				GameObject obj11 = GameObject.Find("/Systems/Audio/HighAndLowAltitudeBG/LowAudio");
				AudioSource val14 = ((obj11 != null) ? obj11.GetComponent<AudioSource>() : null);
				if ((Object)(object)val14 != (Object)null)
				{
					val14.playOnAwake = true;
					if (!val14.isPlaying)
					{
						val14.Play();
					}
					Plugin.Logger.LogDebug((object)"Artifice - Restored nighttime ambience");
				}
				break;
			}
			case "Level10Adamance":
			{
				Plugin.Logger.LogDebug((object)"Detected landing on Adamance");
				if ((Object)(object)val != (Object)null)
				{
					val.localPosition = new Vector3(-108.44491f, -3.2953954f, 8.043371f);
					Plugin.Logger.LogDebug((object)"Adamance - Fixed factory ambience");
				}
				GameObject val11 = GameObject.Find("/Environment/Props/QuicksandSign");
				if ((Object)(object)val11 != (Object)null)
				{
					BoxCollider obj9 = val11.AddComponent<BoxCollider>();
					obj9.center = new Vector3(-0.0035005957f, -0.012053336f, 2.0186164f);
					obj9.size = new Vector3(1.5744015f, 0.14966871f, 4.2035575f);
					Plugin.Logger.LogDebug((object)"Adamance - Fix sign collision");
				}
				flag = false;
				break;
			}
			case "Level11Embrion":
				Plugin.Logger.LogDebug((object)"Detected landing on Embrion");
				if ((Object)(object)val != (Object)null)
				{
					val.localPosition = new Vector3(202.6046f, 14.0158f, 3.280455f);
					Plugin.Logger.LogDebug((object)"Embrion - Fixed factory ambience");
				}
				break;
			case "CompanyBuilding":
			{
				Plugin.Logger.LogDebug((object)"Detected landing on Gordion");
				GameObject val2 = GameObject.Find("/Environment/ScanNodes/ScanNode");
				if ((Object)(object)val2 != (Object)null)
				{
					val2.SetActive(false);
					Plugin.Logger.LogDebug((object)"Gordion - Disabled \"Main entrance\" scan node");
				}
				break;
			}
			default:
				Plugin.Logger.LogInfo((object)"Landed on unknown moon");
				flag = false;
				break;
			}
			if (flag)
			{
				EntranceTeleport[] array = Object.FindObjectsByType<EntranceTeleport>((FindObjectsSortMode)0);
				foreach (EntranceTeleport val17 in array)
				{
					if (val17.isEntranceToBuilding && val17.entranceId > 0)
					{
						val17.entrancePoint.localRotation = Quaternion.Euler(0f, 180f, 0f);
						Plugin.Logger.LogDebug((object)$"Fixed rotation of external fire exit #{val17.entranceId}");
					}
				}
			}
			if (list.Count > 0)
			{
				GameObject obj12 = GameObject.Find("Environment/Map/ModelsIntroScene");
				Transform val18 = ((obj12 != null) ? obj12.transform : null);
				foreach (Transform item in val18)
				{
					Transform val19 = item;
					if (list.Remove(((Object)val19).name))
					{
						((Component)val19).gameObject.SetActive(false);
					}
				}
				Plugin.Logger.LogDebug((object)"Hide out-of-bounds objects (Experimentation and leftovers)");
				if (list.Count > 0)
				{
					int num = 0;
					foreach (string item2 in list)
					{
						Transform val20 = val18.Find(item2);
						if ((Object)(object)val20 != (Object)null)
						{
							((Component)val20).gameObject.SetActive(!((Component)val20).gameObject.activeSelf);
							num++;
						}
					}
					if (list.Count != num)
					{
						Plugin.Logger.LogWarning((object)$"Failed to hide {list.Count} objects:");
						foreach (string item3 in list)
						{
							Plugin.Logger.LogWarning((object)("- \"" + item3 + "\""));
						}
					}
				}
			}
			if (!Compatibility.INSTALLED_GENERAL_IMPROVEMENTS)
			{
				ScanNodeProperties? obj13 = ((IEnumerable<ScanNodeProperties>)Object.FindObjectsByType<ScanNodeProperties>((FindObjectsSortMode)0)).FirstOrDefault((Func<ScanNodeProperties, bool>)((ScanNodeProperties scanNodeProperties) => scanNodeProperties.headerText == "Ship"));
				GlobalReferences.shipNode = ((obj13 != null) ? ((Component)obj13).transform : null);
				if ((Object)(object)GlobalReferences.shipNode != (Object)null)
				{
					GlobalReferences.shipNodeOffset = GlobalReferences.shipNode.position - GlobalReferences.shipDefaultPos;
				}
			}
			if ((Object)(object)StartOfRound.Instance != (Object)null)
			{
				StartOfRound.Instance.mapScreen.checkedForContourMap = false;
			}
		}
	}
	internal static class ScriptableObjectOverrides
	{
		private static Mesh ear;

		private static Mesh severedHandLOD0;

		private static Mesh severedThighLOD0;

		internal static void OverrideEnemyTypes()
		{
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyValuePair<string, EnemyType> allEnemies in GlobalReferences.allEnemiesList)
			{
				switch (allEnemies.Key)
				{
				case "RadMech":
				{
					SkinnedMeshRenderer componentInChildren2 = allEnemies.Value.nestSpawnPrefab.GetComponentInChildren<SkinnedMeshRenderer>();
					if ((Object)(object)componentInChildren2 != (Object)null)
					{
						((Component)componentInChildren2).gameObject.layer = 19;
						Plugin.Logger.LogDebug((object)(allEnemies.Value.enemyName + ": Fix \"nest\" rendering on radar"));
					}
					ScanNodeProperties componentInChildren3 = allEnemies.Value.nestSpawnPrefab.GetComponentInChildren<ScanNodeProperties>();
					if ((Object)(object)componentInChildren3 != (Object)null)
					{
						componentInChildren3.requiresLineOfSight = false;
						((Component)componentInChildren3).transform.localPosition = new Vector3(0f, ((Component)componentInChildren3).transform.localPosition.y, 0f);
						Plugin.Logger.LogDebug((object)(allEnemies.Value.enemyName + ": Scan on both sides"));
					}
					break;
				}
				case "Blob":
					if (!Compatibility.INSTALLED_EVERYTHING_CAN_DIE)
					{
						allEnemies.Value.canDie = false;
						Plugin.Logger.LogDebug((object)(allEnemies.Value.enemyName + ": Don't \"die\" when crushed by spike trap"));
					}
					break;
				case "ForestGiant":
				{
					ScanNodeProperties componentInChildren = allEnemies.Value.enemyPrefab.GetComponentInChildren<ScanNodeProperties>();
					if ((Object)(object)componentInChildren != (Object)null)
					{
						componentInChildren.headerText = "Forest Keeper";
						Plugin.Logger.LogDebug((object)(allEnemies.Value.enemyName + ": Rename scan node"));
					}
					break;
				}
				case "ClaySurgeon":
				{
					allEnemies.Value.enemyPrefab.GetComponent<NavMeshAgent>().speed = 0f;
					Plugin.Logger.LogDebug((object)(allEnemies.Value.enemyName + ": Don't slide around on fresh spawn"));
					Renderer[] componentsInChildren = allEnemies.Value.enemyPrefab.GetComponentsInChildren<Renderer>();
					foreach (Renderer val in componentsInChildren)
					{
						if (((Component)val).gameObject.layer == 19)
						{
							val.shadowCastingMode = (ShadowCastingMode)0;
						}
					}
					break;
				}
				case "CaveDweller":
					((GrabbableObject)allEnemies.Value.enemyPrefab.GetComponent<CaveDwellerPhysicsProp>()).itemProperties.isConductiveMetal = false;
					Plugin.Logger.LogDebug((object)("Conductive: " + allEnemies.Value.enemyName + " (False)"));
					break;
				case "SandWorm":
					allEnemies.Value.canBeDestroyed = false;
					Plugin.Logger.LogDebug((object)(allEnemies.Value.enemyName + ": Don't get eaten by other worms"));
					break;
				}
				allEnemies.Value.numberSpawned = 0;
			}
		}

		internal static void OverrideSelectableLevels()
		{
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				if (((Object)val).name == "RendLevel")
				{
					SpawnableMapObject val2 = ((IEnumerable<SpawnableMapObject>)val.spawnableMapObjects).FirstOrDefault((Func<SpawnableMapObject, bool>)delegate(SpawnableMapObject spawnableMapObject)
					{
						GameObject prefabToSpawn = spawnableMapObject.prefabToSpawn;
						return ((prefabToSpawn != null) ? ((Object)prefabToSpawn).name : null) == "SpikeRoofTrapHazard";
					});
					if (val2 != null)
					{
						val2.requireDistanceBetweenSpawns = true;
						Plugin.Logger.LogDebug((object)"Rend: Space spike traps");
					}
				}
			}
		}

		internal static void OverrideItems()
		{
			if ((Object)(object)ear == (Object)null || (Object)(object)severedHandLOD0 == (Object)null || (Object)(object)severedThighLOD0 == (Object)null)
			{
				try
				{
					AssetBundle obj = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "severedmesh"));
					ear = obj.LoadAsset<Mesh>("Ear");
					severedHandLOD0 = obj.LoadAsset<Mesh>("SeveredHandLOD0");
					severedThighLOD0 = obj.LoadAsset<Mesh>("SeveredThighLOD0");
					obj.Unload(false);
				}
				catch
				{
					Plugin.Logger.LogError((object)"Encountered some error loading assets from bundle \"severedmesh\". Did you install the plugin correctly?");
				}
			}
			Dictionary<string, bool> dictionary = new Dictionary<string, bool>
			{
				{ "DustPan", true },
				{ "FancyCup", true },
				{ "LockPicker", true },
				{ "Phone", true },
				{ "Shotgun", true },
				{ "SprayPaint", true }
			};
			Dictionary<string, bool> dictionary2 = new Dictionary<string, bool>
			{
				{ "Airhorn", false },
				{ "CashRegister", false },
				{ "ChemicalJug", true },
				{ "ClownHorn", false },
				{ "ComedyMask", false },
				{ "RubberDuck", false },
				{ "TragedyMask", false }
			};
			Dictionary<string, bool> dictionary3 = new Dictionary<string, bool>
			{
				{ "BabyKiwiEgg", false },
				{ "ExtensionLadder", false },
				{ "MagnifyingGlass", true },
				{ "PillBottle", true },
				{ "RadarBooster", false },
				{ "SprayPaint", true },
				{ "WeedKillerBottle", true }
			};
			Dictionary<string, Mesh> dictionary4 = new Dictionary<string, Mesh>
			{
				{ "SeveredEar", ear },
				{ "SeveredHand", severedHandLOD0 },
				{ "SeveredThigh", severedThighLOD0 }
			};
			AudioClip val = null;
			AudioClip val2 = null;
			AudioClip val3 = null;
			AudioClip val4 = null;
			AudioClip val5 = null;
			List<Item> list = new List<Item>();
			List<Item> list2 = new List<Item>();
			List<Item> list3 = new List<Item>();
			List<Item> list4 = new List<Item>();
			foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
			{
				if ((Object)(object)items == (Object)null)
				{
					Plugin.Logger.LogWarning((object)"Encountered a missing item in StartOfRound.allItemsList; this is probably an issue with another mod");
					continue;
				}
				bool flag = false;
				GameObject spawnPrefab = items.spawnPrefab;
				ScanNodeProperties val6 = ((spawnPrefab != null) ? spawnPrefab.GetComponentInChildren<ScanNodeProperties>() : null);
				switch (((Object)items).name)
				{
				case "BabyKiwiEgg":
					((GrabbableObject)items.spawnPrefab.GetComponent<KiwiBabyItem>()).isInFactory = false;
					Plugin.Logger.LogDebug((object)"Factory: Egg");
					break;
				case "Boombox":
					items.spawnPrefab.GetComponent<BoomboxItem>().boomboxAudio.dopplerLevel = 0.3f * GlobalReferences.dopplerLevelMult;
					Plugin.Logger.LogDebug((object)"Doppler level: Boombox");
					break;
				case "BottleBin":
					val2 = items.grabSFX;
					break;
				case "ToyCube":
				case "Brush":
				case "Candy":
				case "Dentures":
				case "PillBottle":
				case "PlasticCup":
				case "SoccerBall":
				case "Toothpaste":
				case "Remote":
				case "SteeringWheel":
					list2.Add(items);
					break;
				case "CashRegister":
					if (Configuration.adjustCooldowns.Value)
					{
						((GrabbableObject)items.spawnPrefab.GetComponent<NoisemakerProp>()).useCooldown = 2.35f;
						Plugin.Logger.LogDebug((object)"Cooldown: Cash register");
					}
					break;
				case "ClownHorn":
					if (Configuration.adjustCooldowns.Value)
					{
						((GrabbableObject)items.spawnPrefab.GetComponent<NoisemakerProp>()).useCooldown = 0.35f;
						Plugin.Logger.LogDebug((object)"Cooldown: Clown horn");
					}
					break;
				case "EasterEgg":
				case "MapDevice":
				case "ZapGun":
				case "Cog1":
					flag = true;
					break;
				case "FancyCup":
					if (Configuration.theGoldenGoblet.Value)
					{
						if ((Object)(object)val6 != (Object)null)
						{
							val6.headerText = val6.headerText.Replace("Golden cup", "Golden goblet");
							Plugin.Logger.LogDebug((object)"Scan node: Golden cup");
						}
						items.itemName = items.itemName.Replace("Golden cup", "Golden goblet");
						Plugin.Logger.LogDebug((object)"Name: Golden cup");
					}
					list.Add(items);
					break;
				case "FancyLamp":
					items.verticalOffset = 0f;
					break;
				case "FancyPainting":
					list4.Add(items);
					break;
				case "FishTestProp":
					flag = true;
					list2.Add(items);
					break;
				case "Flashlight":
				case "ProFlashlight":
				{
					FlashlightItem component3 = items.spawnPrefab.GetComponent<FlashlightItem>();
					Material[] sharedMaterials = ((Renderer)component3.flashlightMesh).sharedMaterials;
					sharedMaterials[1] = component3.bulbDark;
					((Renderer)component3.flashlightMesh).sharedMaterials = sharedMaterials;
					Plugin.Logger.LogDebug((object)("Bulb off: " + items.itemName));
					break;
				}
				case "Flask":
					val4 = items.grabSFX;
					break;
				case "GarbageLid":
				case "MetalSheet":
					list.Add(items);
					break;
				case "Hairdryer":
					if (Configuration.adjustCooldowns.Value)
					{
						((GrabbableObject)items.spawnPrefab.GetComponent<NoisemakerProp>()).useCooldown = 1.35f;
						Plugin.Logger.LogDebug((object)"Cooldown: Hairdryer");
					}
					break;
				case "Key":
					if (Configuration.keysAreScrap.Value)
					{
						items.isScrap = true;
						Plugin.Logger.LogDebug((object)"Scrap: Key");
						break;
					}
					((GrabbableObject)items.spawnPrefab.GetComponent<KeyItem>()).scrapValue = 0;
					if ((Object)(object)val6 != (Object)null)
					{
						val6.subText = string.Empty;
						val6.scrapValue = 0;
						Plugin.Logger.LogDebug((object)"Scan node: Key");
					}
					break;
				case "Knife":
				{
					KnifeItem component2 = items.spawnPrefab.GetComponent<KnifeItem>();
					if ((Object)(object)val6 != (Object)null)
					{
						val6.scrapValue = ((GrabbableObject)component2).scrapValue;
						val6.subText = $"Value: ${val6.scrapValue}";
						Plugin.Logger.LogDebug((object)"Scan node: Kitchen knife");
					}
					break;
				}
				case "Mug":
					val3 = items.dropSFX;
					break;
				case "PickleJar":
				case "PerfumeBottle":
					list3.Add(items);
					break;
				case "RedLocustHive":
					flag = true;
					((GrabbableObject)items.spawnPrefab.GetComponent<PhysicsProp>()).isInFactory = false;
					Plugin.Logger.LogDebug((object)"Factory: Hive");
					break;
				case "SeveredHeart":
				{
					LoopShapeKey[] componentsInChildren = items.spawnPrefab.GetComponentsInChildren<LoopShapeKey>();
					if (componentsInChildren == null || componentsInChildren.Length == 0)
					{
						break;
					}
					LoopShapeKey[] array = componentsInChildren;
					foreach (LoopShapeKey val7 in array)
					{
						if ((Object)(object)((Component)val7).GetComponent<HeartHack>() == (Object)null)
						{
							((Component)val7).gameObject.AddComponent<HeartHack>().loopShapeKey = val7;
						}
					}
					Plugin.Logger.LogDebug((object)"Animation: Heart");
					break;
				}
				case "SeveredThigh":
				{
					LODGroup component = items.spawnPrefab.GetComponent<LODGroup>();
					LOD[] lODs = component.GetLODs();
					lODs[0].screenRelativeTransitionHeight = 0.15f;
					component.SetLODs(lODs);
					Plugin.Logger.LogDebug((object)"LoDs: Knee");
					break;
				}
				case "SeveredTongue":
					items.syncDiscardFunction = true;
					Plugin.Logger.LogDebug((object)"Sync: Tongue");
					break;
				case "TeaKettle":
					val = items.grabSFX;
					break;
				case "TragedyMask":
					val5 = items.grabSFX;
					break;
				}
				if (flag)
				{
					items.spawnPrefab.GetComponent<AudioSource>().rolloffMode = (AudioRolloffMode)1;
					Plugin.Logger.LogDebug((object)("Audio rolloff: " + items.itemName));
				}
				if ((Object)(object)items.spawnPrefab != (Object)null)
				{
					bool flag2 = false;
					Renderer[] componentsInChildren2 = items.spawnPrefab.GetComponentsInChildren<Renderer>();
					foreach (Renderer val8 in componentsInChildren2)
					{
						if (val8.enabled && ((Component)val8).gameObject.layer == 13)
						{
							val8.enabled = false;
							flag2 = true;
						}
					}
					if (flag2)
					{
						Plugin.Logger.LogDebug((object)("Invisible trigger: " + items.itemName));
					}
					if ((Object)(object)items.spawnPrefab.GetComponent<Rigidbody>() != (Object)null && (Object)(object)val6 != (Object)null && (Object)(object)((Component)val6).GetComponent<Rigidbody>() == (Object)null)
					{
						((Component)val6).gameObject.AddComponent<Rigidbody>().isKinematic = true;
						Plugin.Logger.LogDebug((object)("Scan node rigidbody: " + items.itemName));
					}
				}
				if (dictionary3.ContainsKey(((Object)items).name))
				{
					items.canBeInspected = dictionary3[((Object)items).name];
					Plugin.Logger.LogDebug((object)$"Inspectable: {items.itemName} ({items.canBeInspected})");
				}
				if (items.canBeInspected)
				{
					if (items.toolTips == null)
					{
						Plugin.Logger.LogWarning((object)("Item \"" + ((Object)items).name + "\" is missing toolTips"));
					}
					else if (items.toolTips.Length < 3)
					{
						bool flag3 = false;
						string[] toolTips = items.toolTips;
						for (int i = 0; i < toolTips.Length; i++)
						{
							if (toolTips[i].StartsWith("Inspect"))
							{
								flag3 = true;
								break;
							}
						}
						if (!flag3)
						{
							items.toolTips = CollectionExtensions.AddToArray<string>(items.toolTips, "Inspect: [Z]");
							Plugin.Logger.LogDebug((object)("Inspect tooltip: " + items.itemName));
						}
					}
				}
				if (dictionary.ContainsKey(((Object)items).name))
				{
					items.isConductiveMetal = dictionary[((Object)items).name] && Configuration.makeConductive.Value;
					Plugin.Logger.LogDebug((object)$"Conductive: {items.itemName} ({items.isConductiveMetal})");
				}
				if (dictionary2.ContainsKey(((Object)items).name) && !Compatibility.INSTALLED_GENERAL_IMPROVEMENTS)
				{
					items.canBeGrabbedBeforeGameStart = dictionary2[((Object)items).name];
					Plugin.Logger.LogDebug((object)$"Hold before ship has landed: {items.itemName} ({items.canBeGrabbedBeforeGameStart})");
				}
				if (dictionary4.TryGetValue(((Object)items).name, out var value) && (Object)(object)value != (Object)null)
				{
					MeshFilter component4 = items.spawnPrefab.GetComponent<MeshFilter>();
					component4.mesh = value;
					component4.mesh.RecalculateNormals();
					component4.mesh.RecalculateTangents();
					Plugin.Logger.LogDebug((object)("Mesh: " + items.itemName));
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				foreach (Item item in list)
				{
					item.grabSFX = val;
					Plugin.Logger.LogDebug((object)("Audio: " + item.itemName));
				}
			}
			if ((Object)(object)val2 != (Object)null)
			{
				foreach (Item item2 in list2)
				{
					item2.grabSFX = val2;
					Plugin.Logger.LogDebug((object)("Audio: " + item2.itemName));
					if (((Object)item2).name == "PillBottle" && (Object)(object)val3 != (Object)null)
					{
						item2.dropSFX = val3;
					}
				}
			}
			if ((Object)(object)val4 != (Object)null)
			{
				foreach (Item item3 in list3)
				{
					item3.grabSFX = val4;
					Plugin.Logger.LogDebug((object)("Audio: " + item3.itemName));
				}
			}
			if (!((Object)(object)val5 != (Object)null))
			{
				return;
			}
			foreach (Item item4 in list4)
			{
				item4.grabSFX = val5;
				Plugin.Logger.LogDebug((object)("Audio: " + item4.itemName));
			}
		}

		internal static void OverrideUnlockables()
		{
			foreach (UnlockableItem unlockable in StartOfRound.Instance.unlockablesList.unlockables)
			{
				switch (unlockable.unlockableName)
				{
				case "Record player":
					unlockable.prefabObject.GetComponentInChildren<AnimatedObjectTrigger>().thisAudioSource.dopplerLevel = GlobalReferences.dopplerLevelMult;
					Plugin.Logger.LogDebug((object)"Doppler level: Record player");
					break;
				case "Disco Ball":
					unlockable.prefabObject.GetComponentInChildren<CozyLights>().turnOnAudio.dopplerLevel = 0.92f * GlobalReferences.dopplerLevelMult;
					Plugin.Logger.LogDebug((object)"Doppler level: Disco ball");
					break;
				case "JackOLantern":
					if (Configuration.adjustCooldowns.Value)
					{
						unlockable.prefabObject.GetComponentInChildren<InteractTrigger>().cooldownTime = 0.45f;
						Plugin.Logger.LogDebug((object)"Cooldown: Jack o' Lantern");
					}
					break;
				case "Plushie pajama man":
					if (Configuration.adjustCooldowns.Value)
					{
						unlockable.prefabObject.GetComponentInChildren<InteractTrigger>().cooldownTime = 0.2f;
						Plugin.Logger.LogDebug((object)"Cooldown: Plushie pajama man");
					}
					break;
				case "Inverse Teleporter":
					if (!Compatibility.INSTALLED_GENERAL_IMPROVEMENTS)
					{
						InteractTrigger buttonTrigger = unlockable.prefabObject.GetComponentInChildren<ShipTeleporter>().buttonTrigger;
						buttonTrigger.hoverTip = buttonTrigger.hoverTip.Replace("Beam up", "Beam out");
						Plugin.Logger.LogDebug((object)"Text: Inverse teleporter");
					}
					break;
				case "Microwave":
				{
					Transform obj = unlockable.prefabObject.transform.Find("MicrowaveBody");
					((Component)obj).gameObject.layer = 8;
					Plugin.Logger.LogDebug((object)"Collision: Microwave");
					((Component)obj).GetComponent<AudioSource>().playOnAwake = true;
					Plugin.Logger.LogDebug((object)"Audio: Microwave");
					InteractTrigger component = ((Component)obj.Find("MicrowaveDoor/DoorButtonClose")).GetComponent<InteractTrigger>();
					component.hoverTip = component.hoverTip.Replace("Store item", "Use microwave");
					Plugin.Logger.LogDebug((object)"Text: Microwave");
					break;
				}
				case "Fridge":
				{
					Transform[] componentsInChildren = unlockable.prefabObject.GetComponentsInChildren<Transform>();
					foreach (Transform val in componentsInChildren)
					{
						if (((Object)val).name == "FridgeBody" || ((Component)val).gameObject.layer == 6)
						{
							((Component)val).gameObject.layer = 8;
						}
						else if ((Object)(object)((Component)val).GetComponent<PlaceableObjectsSurface>() != (Object)null)
						{
							((Component)val).GetComponent<Collider>().isTrigger = false;
						}
					}
					Plugin.Logger.LogDebug((object)"Collision: Fridge");
					break;
				}
				}
			}
		}
	}
	internal static class TileOverrides
	{
		internal static void OverrideTiles(IndoorMapType[] indoorMapTypes)
		{
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject allTile in GetAllTiles(indoorMapTypes))
			{
				switch (((Object)allTile).name)
				{
				case "DoubleDoorRoom":
				case "MediumRoomHallway1B":
				{
					Transform val8 = allTile.transform.Find("AnomalySpawns");
					if ((Object)(object)val8 != (Object)null)
					{
						((Component)val8).gameObject.SetActive(false);
						Plugin.Logger.LogDebug((object)(((Object)allTile).name + ": Removed obsolete triggers (fix spray paint)"));
					}
					break;
				}
				case "4x4BigStairTile":
				{
					RandomScrapSpawn[] componentsInChildren = allTile.GetComponentsInChildren<RandomScrapSpawn>();
					foreach (RandomScrapSpawn val4 in componentsInChildren)
					{
						if (((Object)val4).name.StartsWith("SmallItemsSpawn"))
						{
							((Component)val4).gameObject.SetActive(false);
							Plugin.Logger.LogDebug((object)(((Object)allTile).name + ": Fix scrap stacking"));
						}
					}
					break;
				}
				case "KitchenTile":
				{
					Transform val5 = allTile.transform.Find("TablesMisc");
					if ((Object)(object)val5 != (Object)null)
					{
						Transform obj2 = val5.Find("ArrangementA/coffeeTable");
						BoxCollider val6 = ((obj2 != null) ? ((Component)obj2).GetComponent<BoxCollider>() : null);
						Transform obj3 = val5.Find("ArrangementB/coffeeTable (1)");
						BoxCollider val7 = ((obj3 != null) ? ((Component)obj3).GetComponent<BoxCollider>() : null);
						if ((Object)(object)val6 != (Object)null && (Object)(object)val7 != (Object)null)
						{
							val6.center = val7.center;
							val6.size = val7.size;
							Plugin.Logger.LogDebug((object)(((Object)allTile).name + ": Adjusted collider on prop \"" + ((Object)val6).name + "\""));
						}
					}
					break;
				}
				case "GreenhouseTile":
				{
					string[] array = new string[4] { "Colliders/Cube (4)", "Colliders/Cube (6)", "Colliders/Cube (7)", "Colliders/Cube (5)" };
					foreach (string text in array)
					{
						Transform obj = allTile.transform.Find(text);
						GameObject val3 = ((obj != null) ? ((Component)obj).gameObject : null);
						if ((Object)(object)val3 != (Object)null)
						{
							val3.SetActive(false);
							Plugin.Logger.LogDebug((object)(((Object)allTile).name + ": Removed unused collider \"" + ((Object)val3).name + "\""));
						}
					}
					break;
				}
				case "GarageTile":
				{
					if (Chainloader.PluginInfos.ContainsKey("watergun.v72lightfix"))
					{
						Plugin.Logger.LogInfo((object)"CROSS-COMPATIBILITY - V70PoweredLights Fix detected");
						break;
					}
					Transform val = allTile.transform.Find("HangingLEDBarLight (4)");
					Transform val2 = val.Find("IndirectLight (1)");
					if ((Object)(object)val2 != (Object)null && (Object)(object)val.Find("IndirectLight") == (Object)null)
					{
						((Object)val2).name = "IndirectLight";
						Plugin.Logger.LogDebug((object)(((Object)allTile).name + ": Corrected child reference for \"" + ((Object)val).name + "\""));
					}
					break;
				}
				}
				if (((Object)allTile).name.StartsWith("Cave") || ((Object)allTile).name.Contains("Tunnel"))
				{
					ParticleSystemRenderer[] componentsInChildren2 = allTile.GetComponentsInChildren<ParticleSystemRenderer>();
					foreach (ParticleSystemRenderer val9 in componentsInChildren2)
					{
						if ((Object)(object)((Renderer)val9).sharedMaterial != (Object)null && ((Object)((Renderer)val9).sharedMaterial).name.StartsWith("RainParticle") && !((Object)val9).name.StartsWith("RainHit"))
						{
							val9.renderMode = (ParticleSystemRenderMode)3;
							Plugin.Logger.LogDebug((object)(((Object)allTile).name + ": Fix drip billboarding"));
						}
					}
				}
				Animator[] componentsInChildren3 = allTile.GetComponentsInChildren<Animator>();
				if (componentsInChildren3 == null || componentsInChildren3.Length == 0)
				{
					continue;
				}
				Animator[] array2 = componentsInChildren3;
				foreach (Animator val10 in array2)
				{
					if (!((Component)val10).CompareTag("PoweredLight") && (Object)(object)val10.runtimeAnimatorController != (Object)null && (((Object)val10.runtimeAnimatorController).name.StartsWith("MineshaftSpotlight") || ((Object)val10.runtimeAnimatorController).name.StartsWith("LEDHangingLight")))
					{
						((Component)val10).tag = "PoweredLight";
						Plugin.Logger.LogDebug((object)(((Object)allTile).name + ": Fix power state for \"" + ((Object)val10).name + "\""));
					}
				}
			}
		}

		private static List<GameObject> GetAllTiles(IndoorMapType[] indoorMapTypes)
		{
			List<TileSet> list = new List<TileSet>();
			HashSet<GameObject> hashSet = new HashSet<GameObject>();
			foreach (IndoorMapType val in indoorMapTypes)
			{
				foreach (GraphNode node in val.dungeonFlow.Nodes)
				{
					list.AddRange(node.TileSets);
				}
				foreach (GraphLine line in val.dungeonFlow.Lines)
				{
					foreach (DungeonArchetype dungeonArchetype in line.DungeonArchetypes)
					{
						list.AddRange(dungeonArchetype.TileSets);
					}
				}
				foreach (TileSet item in list)
				{
					foreach (GameObjectChance weight in item.TileWeights.Weights)
					{
						if (hashSet.Add(weight.Value))
						{
							Plugin.Logger.LogDebug((object)("Cached reference to tile \"" + ((Object)weight.Value).name + "\""));
						}
					}
				}
			}
			return hashSet.ToList();
		}
	}
}
namespace ButteryFixes.Patches.Player
{
	[HarmonyPatch(typeof(DeadBodyInfo))]
	internal class BodyPatches
	{
		private static bool dontCheckRenderers;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void DeadBodyInfo_Post_Start(DeadBodyInfo __instance)
		{
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Invalid comparison between Unknown and I4
			//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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Invalid comparison between Unknown and I4
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Invalid comparison between Unknown and I4
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Invalid comparison between Unknown and I4
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Invalid comparison between Unknown and I4
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0504: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			if (Configuration.bodiesCollectSelf.Value)
			{
				if (!__instance.playerScript.isInHangarShipRoom)
				{
					Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds;
					if (!((Bounds)(ref bounds)).Contains(__instance.playerScript.positionOfDeath))
					{
						goto IL_00a5;
					}
				}
				Plugin.Logger.LogDebug((object)("Player \"" + __instance.playerScript?.playerUsername + "\" died inside the ship"));
				if (!((Object)__instance).name.Contains("Mask Variant") || ((Object)StartOfRound.Instance.currentLevel).name == "CompanyBuildingLevel")
				{
					((MonoBehaviour)__instance).StartCoroutine(NonPatchFunctions.TryAutoCollectBody(__instance));
				}
			}
			goto IL_00a5;
			IL_00a5:
			if (!Configuration.playermodelPatches.Value)
			{
				return;
			}
			if ((int)__instance.causeOfDeath == 14)
			{
				__instance.MakeCorpseBloody();
			}
			if ((int)__instance.causeOfDeath == 3 && (int)StartOfRound.Instance.currentLevel.currentWeather == 2 && (Object)(object)__instance.playerScript != (Object)null && __instance.playerScript.positionOfDeath.y >= -100f)
			{
				Plugin.Logger.LogDebug((object)("Player \"" + __instance.playerScript?.playerUsername + "\" died to \"Blast\" outside during stormy weather"));
				((MonoBehaviour)__instance).StartCoroutine(NonPatchFunctions.LightningShakesBody(__instance));
			}
			SkinnedMeshRenderer componentInChildren = ((Component)__instance).GetComponentInChildren<SkinnedMeshRenderer>();
			if (!((Object)(object)componentInChildren != (Object)null) || !((Object)(object)StartOfRound.Instance != (Object)null))
			{
				return;
			}
			UnlockableItem val = StartOfRound.Instance.unlockablesList.unlockables[__instance.playerScript.currentSuitID];
			if (val == null)
			{
				return;
			}
			try
			{
				Material val2 = ((Renderer)componentInChildren).sharedMaterials[0];
				bool flag = false;
				if (Config