Decompiled source of Habitat Interior v1.2.0

Interior.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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.Logging;
using Dawn.Utils;
using DunGen;
using Dusk;
using GameNetcodeStuff;
using HarmonyLib;
using Interior.NetcodePatcher;
using Interior.Patches;
using Interior.Scripts;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("DunGen")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")]
[assembly: IgnoresAccessChecksTo("Unity.XR.Management")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Interior")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1c73b4a83104f9d2a14fca1aba45d9bedc4d3039")]
[assembly: AssemblyProduct("Interior")]
[assembly: AssemblyTitle("Interior")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Interior
{
	internal class HabitatContentHandler : ContentHandler<HabitatContentHandler>
	{
		public class HabitatAssets : AssetBundleLoader<HabitatAssets>
		{
			public HabitatAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class HabitatApparatusAssets : AssetBundleLoader<HabitatApparatusAssets>
		{
			public HabitatApparatusAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		internal HabitatAssets? habitatAssets;

		internal HabitatApparatusAssets? apparatusAssets;

		public HabitatContentHandler(DuskMod mod)
			: base(mod)
		{
			((ContentHandler)this).RegisterContent<HabitatAssets>("habitat_dungeondef", ref habitatAssets, false);
			((ContentHandler)this).RegisterContent<HabitatApparatusAssets>("habitat_apparatusdef", ref apparatusAssets, false);
		}
	}
	[BepInPlugin("mborsh.HabitatIntreior", "Habitat Interior", "1.2.0")]
	internal class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "mborsh.HabitatIntreior";

		public const string modName = "Habitat Interior";

		public const string modVersion = "1.2.0";

		public static Plugin Instance = null;

		internal static ManualLogSource mls = null;

		internal static readonly Harmony harmony = new Harmony("mborsh.HabitatIntreior");

		internal static DuskMod mod = null;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = ((BaseUnityPlugin)this).Logger;
			AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "habitat_contentcontainer");
			mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val);
			mod.RegisterContentHandlers();
			harmony.PatchAll(typeof(CentipedePatch));
			harmony.PatchAll(typeof(EntranceTeleportPatch));
			harmony.PatchAll(typeof(RoundManagerPatch));
			mls.LogInfo((object)"Habitat Interior Plugin loaded!");
		}
	}
}
namespace Interior.Scripts
{
	public class ApparatusMachineThing : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <WaitUntilLanding>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ApparatusMachineThing <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Expected O, but got Unknown
				//IL_00cb: 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 WaitUntil((Func<bool>)(() => StartOfRound.Instance.inShipPhase));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.lungProp = Object.FindObjectsOfType<LungPropExtension>().FirstOrDefault((LungPropExtension lp) => Vector3.Distance(((Component)<>4__this).transform.position, ((Component)lp).transform.position) <= 20f);
					if (!Object.op_Implicit((Object)(object)<>4__this.lungProp))
					{
						Plugin.mls.LogError((object)"Something wrong with apparatus machine/apparatus script!!! Report that to creator of this interior please.");
						Plugin.mls.LogError((object)"Host was unable to find new apparatus");
						return false;
					}
					<>4__this.SendLungPropClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)<>4__this.lungProp));
					return false;
				}
			}

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

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

		public static ApparatusMachineThing Instance;

		public LungPropExtension lungProp = null;

		public int leverCount = 4;

		public Animator animator = null;

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			Instance = this;
			if (((NetworkBehaviour)this).NetworkManager.IsHost)
			{
				((MonoBehaviour)this).StartCoroutine(WaitUntilLanding());
			}
		}

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

		[ClientRpc]
		private void SendLungPropClientRpc(NetworkBehaviourReference lpr)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1257015427u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref lpr, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1257015427u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			LungPropExtension lungPropExtension = default(LungPropExtension);
			if (!((NetworkBehaviourReference)(ref lpr)).TryGet<LungPropExtension>(ref lungPropExtension, (NetworkManager)null))
			{
				Plugin.mls.LogError((object)"Something wrong with apparatus machine/apparatus script!!! Report that to creator of this interior please.");
				Plugin.mls.LogError((object)"Something went wrong on recieving lung prop on ClientRpc");
				return;
			}
			lungProp = lungPropExtension;
			((GrabbableObject)lungProp).grabbable = false;
			((GrabbableObject)lungProp).grabbableToEnemies = false;
			((LungProp)lungProp).isLungDocked = true;
			((LungProp)lungProp).isLungPowered = true;
			if ((Object)(object)lungProp.apparatusAudio != (Object)null)
			{
				lungProp.apparatusAudio.loop = true;
				lungProp.apparatusAudio.Play();
			}
		}

		public override void OnNetworkDespawn()
		{
			((NetworkBehaviour)this).OnNetworkDespawn();
			Instance = null;
		}

		public void SendLeverOpen()
		{
			SendLeverOpenServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void SendLeverOpenServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1954329279u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1954329279u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				leverCount--;
				if (leverCount == 0)
				{
					SendLeverOpenClientRpc();
				}
			}
		}

		[ClientRpc]
		public void SendLeverOpenClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1084562974u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1084562974u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				animator.SetTrigger("OpenShell");
				if ((Object)(object)lungProp != (Object)null)
				{
					((GrabbableObject)lungProp).grabbable = true;
					((GrabbableObject)lungProp).grabbableToEnemies = true;
				}
				else
				{
					Plugin.mls.LogError((object)"Something wrong with apparatus machine/apparatus script!!! Report that to creator of this interior please.");
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1257015427u, new RpcReceiveHandler(__rpc_handler_1257015427), "SendLungPropClientRpc");
			((NetworkBehaviour)this).__registerRpc(1954329279u, new RpcReceiveHandler(__rpc_handler_1954329279), "SendLeverOpenServerRpc");
			((NetworkBehaviour)this).__registerRpc(1084562974u, new RpcReceiveHandler(__rpc_handler_1084562974), "SendLeverOpenClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_1257015427(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference lpr = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref lpr, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ApparatusMachineThing)(object)target).SendLungPropClientRpc(lpr);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ApparatusMachineThing";
		}
	}
	internal class CustomWater : MonoBehaviour
	{
		public float movementHinderance = 0.7f;

		private bool isSinkingLocalPlayer;

		public int audioClipIndex = 1;

		public Collider? waterCollider;

		private void OnTriggerStay(Collider other)
		{
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			if (!((Component)other).gameObject.CompareTag("Player"))
			{
				return;
			}
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if ((Object)(object)component != (Object)(object)StartOfRound.Instance.localPlayerController)
			{
				return;
			}
			if (component.isInElevator || component.isInHangarShipRoom)
			{
				if (isSinkingLocalPlayer)
				{
					StopSinking(component);
				}
				return;
			}
			component.underwaterCollider = waterCollider;
			component.isUnderwater = true;
			component.statusEffectAudioIndex = audioClipIndex;
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)component && (component.isFallingFromJump || component.isFallingNoJump) && component.fallValue < -4f)
			{
				TimeOfDay.Instance.WaterSplashEffect(((Component)component).transform.position, component.fallValue > -17f, true);
			}
			if (component.isSinking)
			{
				return;
			}
			if (isSinkingLocalPlayer)
			{
				if (!CheckConditions(component))
				{
					StopSinking(component);
				}
			}
			else if (CheckConditions(component))
			{
				Plugin.mls.LogInfo((object)"Set local player sinking in custom water to true!");
				isSinkingLocalPlayer = true;
				component.isMovementHindered++;
				component.sourcesCausingSinking++;
				component.hinderedMultiplier *= movementHinderance;
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if (isSinkingLocalPlayer && ((Component)other).gameObject.CompareTag("Player"))
			{
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if (!((Object)(object)component != (Object)(object)StartOfRound.Instance.localPlayerController))
				{
					StopSinking(component);
				}
			}
		}

		public bool CheckConditions(PlayerControllerB player)
		{
			if (player.isInHangarShipRoom || player.isInElevator)
			{
				return false;
			}
			return true;
		}

		public void StopSinking(PlayerControllerB player)
		{
			Plugin.mls.LogInfo((object)"Set local player in custom water to false!");
			isSinkingLocalPlayer = false;
			player.isMovementHindered = Mathf.Clamp(player.isMovementHindered - 1, 0, 100);
			player.hinderedMultiplier = Mathf.Clamp(player.hinderedMultiplier / movementHinderance, 1f, 100f);
			player.sourcesCausingSinking = Mathf.Clamp(player.sourcesCausingSinking - 1, 0, 100);
			if (player.isMovementHindered == 0)
			{
				player.isUnderwater = false;
			}
		}
	}
	internal class KillTrigger : MonoBehaviour
	{
		private void OnTriggerEnter(Collider other)
		{
			//IL_0033: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)other).CompareTag("Player"))
			{
				PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
				if (!((Object)(object)component != (Object)(object)StartOfRound.Instance.localPlayerController))
				{
					component.KillPlayer(Vector3.zero, true, (CauseOfDeath)2, 0, default(Vector3), false);
				}
			}
		}
	}
	internal class LampsRandomizer : NetworkBehaviour
	{
		public Animator? lampAnimator;

		private float chance;

		private NetworkVariable<bool> on = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		internal static List<LampsRandomizer> lamps = new List<LampsRandomizer>();

		private void Awake()
		{
			lamps.Add(this);
		}

		public void SetLampState()
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			chance = ((AssetBundleLoader<HabitatContentHandler.HabitatAssets>)(object)ContentHandler<HabitatContentHandler>.Instance.habitatAssets).GetConfig<float>("Lamp disable chance").Value;
			if (!((Object)(object)lampAnimator == (Object)null) && !(chance <= 0f))
			{
				if (((NetworkBehaviour)this).NetworkManager.IsServer)
				{
					Random random = new Random();
					on.Value = RandomExtensions.NextFloat(random, 0f, 100f) > chance;
				}
				lampAnimator.SetBool("on", on.Value);
				if (!on.Value)
				{
					Plugin.mls.LogDebug((object)$"Lamp: {((Object)((Component)lampAnimator).gameObject).name}, state: {on.Value}, position: {((Component)lampAnimator).transform.position}");
				}
			}
		}

		public override void OnDestroy()
		{
			lamps.Remove(this);
		}

		protected override void __initializeVariables()
		{
			if (on == null)
			{
				throw new Exception("LampsRandomizer.on cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)on).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)on, "on");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)on);
			((NetworkBehaviour)this).__initializeVariables();
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "LampsRandomizer";
		}
	}
	public class LungPropExtension : LungProp
	{
		[Space(10f)]
		public AudioSource? apparatusAudio;

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			Plugin.mls.LogInfo((object)"LungPropExtension spawned!");
		}

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "LungPropExtension";
		}
	}
	[Serializable]
	public class Materials
	{
		public Material[] materials;
	}
	internal class MaterialRandomizer : NetworkBehaviour
	{
		[SerializeField]
		public Materials[] materials;

		public MeshRenderer? meshRenderer;

		private NetworkVariable<int> current = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (materials.Length != 0 && !((Object)(object)meshRenderer == (Object)null))
			{
				if (((NetworkBehaviour)this).IsServer)
				{
					Random random = new Random();
					current.Value = random.Next(materials.Length);
				}
				((Renderer)meshRenderer).sharedMaterials = materials[current.Value].materials;
			}
		}

		protected override void __initializeVariables()
		{
			if (current == null)
			{
				throw new Exception("MaterialRandomizer.current cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)current).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)current, "current");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)current);
			((NetworkBehaviour)this).__initializeVariables();
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "MaterialRandomizer";
		}
	}
	internal class OnStartRandom : NetworkBehaviour
	{
		public UnityEvent? onStartClients;

		public UnityEvent? onStartServer;

		[Range(0f, 100f)]
		public float onStartChance;

		private NetworkVariable<float> randomizedInt = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (onStartChance == 0f || (((UnityEventBase)onStartClients).GetPersistentEventCount() == 0 && ((UnityEventBase)onStartServer).GetPersistentEventCount() == 0))
			{
				return;
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				Random random = new Random();
				randomizedInt.Value = RandomExtensions.NextFloat(random, 0f, onStartChance + 1f);
				if (randomizedInt.Value <= onStartChance)
				{
					onStartServer.Invoke();
				}
			}
			if (randomizedInt.Value <= onStartChance)
			{
				onStartClients.Invoke();
			}
		}

		protected override void __initializeVariables()
		{
			if (randomizedInt == null)
			{
				throw new Exception("OnStartRandom.randomizedInt cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)randomizedInt).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)randomizedInt, "randomizedInt");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)randomizedInt);
			((NetworkBehaviour)this).__initializeVariables();
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string? __getTypeName()
		{
			return "OnStartRandom";
		}
	}
	public class SpawnGrassOnMeshWithExclusion : SpawnGrassOnMesh
	{
		public Collider[] exclusionZones = null;

		public bool onlyRenderIndoors = false;

		private Camera camera = null;

		private RenderParams renderParams;

		private readonly List<Bounds> ChunkBounds = new List<Bounds>();

		private void Start()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			base.terrainMesh = ((Component)this).GetComponent<MeshFilter>().mesh;
			if ((Object)(object)base.mesh == (Object)null || (Object)(object)base.terrainMesh == (Object)null)
			{
				Plugin.mls.LogError((object)"GrassSpawner requires a Mesh component");
				((Behaviour)this).enabled = false;
				return;
			}
			RenderParams val = default(RenderParams);
			((RenderParams)(ref val))..ctor(base.material);
			((RenderParams)(ref val)).layer = ((Component)this).gameObject.layer;
			((RenderParams)(ref val)).lightProbeUsage = (LightProbeUsage)1;
			((RenderParams)(ref val)).receiveShadows = true;
			((RenderParams)(ref val)).shadowCastingMode = (ShadowCastingMode)0;
			renderParams = val;
			if (!base.spawnManually)
			{
				SpawnGrass();
			}
		}

		private void Update()
		{
			if ((Object)(object)GameNetworkManager.Instance == (Object)null)
			{
				RenderBatches();
			}
			else
			{
				if (!base.spawnedGrass)
				{
					return;
				}
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if (localPlayerController == null || !localPlayerController.isInsideFactory || onlyRenderIndoors)
				{
					PlayerControllerB localPlayerController2 = GameNetworkManager.Instance.localPlayerController;
					if (localPlayerController2 == null || localPlayerController2.isInsideFactory || base.onlyRenderOutdoors)
					{
						RenderBatches();
					}
				}
			}
		}

		private bool IsPointInExclusionZone(Vector3 point)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = exclusionZones;
			foreach (Collider val in array)
			{
				if (!((Object)(object)val == (Object)null))
				{
					Vector3 val2 = val.ClosestPoint(point);
					if (val2 == point)
					{
						return true;
					}
				}
			}
			return false;
		}

		[ContextMenu("SpawnGrass")]
		private void SpawnGrass()
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			base.Batches.Clear();
			base.ChunkPositions.Clear();
			ChunkBounds.Clear();
			List<Vector3> list = base.terrainMesh.vertices.ToList();
			List<int> list2 = base.terrainMesh.triangles.ToList();
			int num = 0;
			List<Matrix4x4> list3 = new List<Matrix4x4>();
			for (int i = 0; i < base.numberOfBlades; i++)
			{
				num = Random.Range(0, list2.Count / 3);
				int index = list2[num * 3];
				int index2 = list2[num * 3 + 1];
				int index3 = list2[num * 3 + 2];
				Vector3 val = ((Component)this).transform.TransformPoint(list[index]);
				Vector3 val2 = ((Component)this).transform.TransformPoint(list[index2]);
				Vector3 val3 = ((Component)this).transform.TransformPoint(list[index3]);
				Vector3 randomPointInTriangle = ((SpawnGrassOnMesh)this).GetRandomPointInTriangle(val, val2, val3);
				if (!IsPointInExclusionZone(randomPointInTriangle))
				{
					Vector3 val4 = Vector3.Cross(val2 - val, val3 - val);
					Vector3 normalized = ((Vector3)(ref val4)).normalized;
					if (!(Vector3.Angle(normalized, Vector3.up) > base.maxSlope))
					{
						list3.Add(Matrix4x4.TRS(randomPointInTriangle, Quaternion.FromToRotation(Vector3.up, normalized), Vector3.Scale(Vector3.one, new Vector3(1f, Random.Range(base.minVerticalScale, 1f), 1f)) * Random.Range(base.minScale, base.maxScale)));
					}
				}
			}
			Bounds bounds = base.terrainMesh.bounds;
			Vector3 val5 = ((Component)this).transform.TransformPoint(((Bounds)(ref bounds)).center);
			Vector3 val6 = Vector3.Scale(((Bounds)(ref bounds)).size, ((Component)this).transform.lossyScale);
			Bounds val7 = default(Bounds);
			((Bounds)(ref val7))..ctor(val5, val6);
			Vector3 val8 = ((Bounds)(ref val7)).min + new Vector3((float)base.cellSize / 2f, 0f, (float)base.cellSize / 2f);
			Plugin.mls.LogInfo((object)$"bounds sizes {((Bounds)(ref val7)).size.x}; {((Bounds)(ref val7)).size.z} ; {base.cellSize}");
			int num2 = Mathf.CeilToInt(((Bounds)(ref val7)).size.x / (float)base.cellSize);
			int num3 = Mathf.CeilToInt(((Bounds)(ref val7)).size.z / (float)base.cellSize);
			for (int j = 0; j < num2; j++)
			{
				for (int k = 0; k < num3; k++)
				{
					Vector3 val9 = val8 + new Vector3((float)(j * base.cellSize), 0f, (float)(k * base.cellSize));
					base.ChunkPositions.Add(val9);
					ChunkBounds.Add(new Bounds(val9, new Vector3((float)base.cellSize, 50f, (float)base.cellSize)));
				}
			}
			Vector3 zero = Vector3.zero;
			for (int l = 0; l < base.ChunkPositions.Count; l++)
			{
				base.Batches.Add(new List<Matrix4x4>());
			}
			foreach (Matrix4x4 item in list3)
			{
				Matrix4x4 current = item;
				zero = ((Matrix4x4)(ref current)).GetPosition();
				for (int m = 0; m < ChunkBounds.Count; m++)
				{
					Bounds val10 = ChunkBounds[m];
					if (((Bounds)(ref val10)).Contains(zero))
					{
						if (base.Batches[m].Count < 1023)
						{
							base.Batches[m].Add(current);
						}
						break;
					}
				}
			}
			base.spawnedGrass = true;
		}

		private void RenderBatches()
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			camera = (((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)StartOfRound.Instance.activeCamera == (Object)null) ? Camera.main : StartOfRound.Instance.activeCamera);
			if (!Object.op_Implicit((Object)(object)camera))
			{
				return;
			}
			Plane[] array = GeometryUtility.CalculateFrustumPlanes(camera);
			float num = base.chunkDrawDistance * base.chunkDrawDistance;
			Vector3 val2 = default(Vector3);
			for (int i = 0; i < base.Batches.Count && i < base.ChunkPositions.Count; i++)
			{
				List<Matrix4x4> list = base.Batches[i];
				if (list == null || list.Count == 0)
				{
					continue;
				}
				Vector3 val = base.ChunkPositions[i];
				((Vector3)(ref val2))..ctor(((Component)camera).transform.position.x - val.x, 0f, ((Component)camera).transform.position.z - val.z);
				if (!(((Vector3)(ref val2)).sqrMagnitude > num) && GeometryUtility.TestPlanesAABB(array, ChunkBounds[i]))
				{
					((RenderParams)(ref renderParams)).worldBounds = ChunkBounds[i];
					for (int j = 0; j < base.mesh.subMeshCount; j++)
					{
						Graphics.RenderMeshInstanced<Matrix4x4>(ref renderParams, base.mesh, j, list, -1, 0);
					}
				}
			}
		}
	}
	public class SphereBlockerChecker : MonoBehaviour
	{
		public List<Doorway> doorways = new List<Doorway>();

		private void Start()
		{
			foreach (Doorway doorway in doorways)
			{
				if (!((Object)(object)doorway == (Object)null) && !((Object)(object)doorway.ConnectedDoorway == (Object)null) && ((Object)(object)doorway.Tile.Placement.TileSet == (Object)(object)doorway.ConnectedDoorway.Tile.Placement.TileSet || !((AssetBundleLoader<HabitatContentHandler.HabitatAssets>)(object)ContentHandler<HabitatContentHandler>.Instance.habitatAssets).GetConfig<bool>("Enable forcefields").Value))
				{
					Object.Destroy((Object)(object)doorway.ConnectorSceneObjects[0]);
				}
			}
		}
	}
	internal class SunHider : MonoBehaviour
	{
		private MeshRenderer? sunTexture;

		internal static UnityEvent onDungeonEntered = new UnityEvent();

		internal static UnityEvent onDungeonExited = new UnityEvent();

		private bool foundSun = false;

		private void Awake()
		{
			Transform val = ((Object.op_Implicit((Object)(object)TimeOfDay.Instance) && Object.op_Implicit((Object)(object)TimeOfDay.Instance.sunAnimator)) ? ((Component)TimeOfDay.Instance.sunAnimator).transform.Find("SunTexture") : null);
			foundSun = (Object)(object)val != (Object)null && ((Component)val).TryGetComponent<MeshRenderer>(ref sunTexture);
		}

		private void OnEnable()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			onDungeonEntered.AddListener(new UnityAction(HideSun));
			onDungeonExited.AddListener(new UnityAction(RevealSun));
			((UnityEvent<PlayerControllerB>)(object)StartOfRound.Instance.playerTeleportedEvent).AddListener((UnityAction<PlayerControllerB>)ToggleSun);
		}

		private void OnDisable()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			onDungeonEntered.RemoveListener(new UnityAction(HideSun));
			onDungeonExited.RemoveListener(new UnityAction(RevealSun));
			((UnityEvent<PlayerControllerB>)(object)StartOfRound.Instance.playerTeleportedEvent).RemoveListener((UnityAction<PlayerControllerB>)ToggleSun);
		}

		private void RevealSun()
		{
			if (foundSun)
			{
				((Renderer)sunTexture).enabled = true;
			}
		}

		private void HideSun()
		{
			if (foundSun)
			{
				((Renderer)sunTexture).enabled = false;
			}
		}

		private void ToggleSun(PlayerControllerB player)
		{
			if (!player.isInsideFactory)
			{
				HideSun();
			}
			else
			{
				RevealSun();
			}
		}
	}
}
namespace Interior.Patches
{
	internal class CentipedePatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch(typeof(CentipedeAI), "RaycastToCeiling")]
		private static IEnumerable<CodeInstruction> RaycastToCeilingPatch(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)20f, (string)null)
			}).SetInstruction(new CodeInstruction(OpCodes.Ldc_R4, (object)80f));
			return val.InstructionEnumeration();
		}

		[HarmonyTranspiler]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static IEnumerable<CodeInstruction> FallFromCeilingPatch(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)20f, (string)null)
			}).SetInstruction(new CodeInstruction(OpCodes.Ldc_R4, (object)80f));
			return val.InstructionEnumeration();
		}
	}
	internal class EntranceTeleportPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayerServerRpc")]
		internal static void TeleportPlayerServerRpcPatch(EntranceTeleport __instance)
		{
			if (((NetworkBehaviour)__instance).NetworkManager.IsServer)
			{
				if (__instance.isEntranceToBuilding)
				{
					SunHider.onDungeonEntered.Invoke();
				}
				else
				{
					SunHider.onDungeonExited.Invoke();
				}
			}
		}
	}
	internal class RoundManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(RoundManager), "TurnOnAllLights")]
		private static void TurnOnAllLightsPatch(bool on)
		{
			if (!on)
			{
				return;
			}
			foreach (LampsRandomizer lamp in LampsRandomizer.lamps)
			{
				lamp.SetLampState();
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
			NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
			NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
			NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>();
			NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>();
		}
	}
}
namespace Interior.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}