Decompiled source of GallusRefit v1.6.1

GallusHoldFix.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace GallusHoldFix
{
	internal static class GallusBowLadder
	{
		private struct Spec
		{
			public string key;

			public string hatch;

			public Vector3 top;

			public Vector3 foot;

			public int treads;

			public float half;

			public float first;
		}

		private struct Box
		{
			public Vector3 c;

			public Vector3 a;

			public Vector3 b;

			public Vector3 d;

			public Vector3 h;
		}

		internal class LadderFold : MonoBehaviour
		{
			public GameObject walkGroup;

			public Transform knee;

			public GPButtonTrapdoor door;

			public Quaternion upperStowed;

			public Quaternion kneeStowed;

			public float kneeSign = 1f;

			public Vector3 hang;

			private float _t = -1f;

			private static MethodInfo _activate;

			private static FieldInfo _inMotion;

			private GallusCargoHatch.LidFold _hatch;

			private Quaternion _stowHatch;

			public Transform boat;

			public GameObject rung;

			public List<GameObject> lowerWalk;

			private int _half = -1;

			internal bool lift;

			private static FieldInfo _walkColField;

			private float _nextWalkCheck;

			internal float Down01 => Mathf.Clamp01(_t);

			private void Half()
			{
				if ((Object)(object)boat == (Object)null)
				{
					return;
				}
				bool flag = GallusPlatforms.AftCabinFitted(boat);
				if ((flag ? 1 : 0) == _half)
				{
					return;
				}
				_half = (flag ? 1 : 0);
				if ((Object)(object)knee != (Object)null && ((Component)knee).gameObject.activeSelf == flag)
				{
					((Component)knee).gameObject.SetActive(!flag);
				}
				if ((Object)(object)rung != (Object)null && rung.activeSelf != flag)
				{
					rung.SetActive(flag);
				}
				if (lowerWalk != null)
				{
					foreach (GameObject item in lowerWalk)
					{
						if ((Object)(object)item != (Object)null && item.activeSelf == flag)
						{
							item.SetActive(!flag);
						}
					}
				}
				if (GallusHoldFixPlugin.Log != null)
				{
					GallusHoldFixPlugin.Log.LogInfo((object)("Gallus loft ladder: the stern ladder is " + (flag ? ("its top half only - an aft-cabin deck is fitted under it, the lower half and " + ((lowerWalk != null) ? lowerWalk.Count : 0) + " lower tread(s) put away") : "whole - no aft-cabin deck under it") + "."));
				}
			}

			internal void SetCompanionway(GallusCargoHatch.LidFold hatch, Vector3 face)
			{
				//IL_0024: 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_0030: 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)
				_hatch = hatch;
				if ((Object)(object)hatch != (Object)null && ((Vector3)(ref hang)).sqrMagnitude > 0f)
				{
					_stowHatch = Quaternion.FromToRotation(hang, ((Vector3)(ref face)).normalized);
				}
				if ((Object)(object)door != (Object)null && ((Component)door).gameObject.activeSelf != ((Object)(object)hatch == (Object)null))
				{
					((Component)door).gameObject.SetActive((Object)(object)hatch == (Object)null);
				}
				TrapdoorWalk((Object)(object)hatch == (Object)null);
				if (_t >= 0f)
				{
					Pose();
				}
			}

			private void TrapdoorWalk(bool on)
			{
				if (!((Object)(object)door == (Object)null))
				{
					if (_walkColField == null)
					{
						_walkColField = typeof(GPButtonTrapdoor).GetField("walkCol", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					}
					Transform val = (Transform)((_walkColField != null) ? /*isinst with value type is only supported in some contexts*/: null);
					if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf != on)
					{
						((Component)val).gameObject.SetActive(on);
					}
				}
			}

			internal void Click()
			{
				if ((Object)(object)_hatch != (Object)null)
				{
					_hatch.Click();
				}
				else
				{
					if ((Object)(object)door == (Object)null)
					{
						return;
					}
					if (_inMotion == null)
					{
						_inMotion = typeof(GPButtonTrapdoor).GetField("inMotion", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					}
					if (!(_inMotion != null) || !(bool)_inMotion.GetValue(door))
					{
						if (_activate == null)
						{
							_activate = typeof(GPButtonTrapdoor).GetMethod("OnActivate", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);
						}
						if (_activate != null)
						{
							_activate.Invoke(door, null);
						}
					}
				}
			}

			private void Update()
			{
				Half();
				bool num;
				if (!((Object)(object)_hatch != (Object)null))
				{
					if ((Object)(object)door == (Object)null)
					{
						goto IL_003f;
					}
					num = door.IsOpen();
				}
				else
				{
					num = _hatch.open;
				}
				if (num)
				{
					goto IL_003f;
				}
				int num2 = 0;
				goto IL_004b;
				IL_004b:
				if ((Object)(object)_hatch != (Object)null && Time.time > _nextWalkCheck)
				{
					_nextWalkCheck = Time.time + 1f;
					TrapdoorWalk(on: false);
				}
				float num3 = ((num2 != 0) ? 1f : 0f);
				if (_t < 0f)
				{
					_t = num3;
					Pose();
				}
				else if (_t != num3)
				{
					_t = Mathf.MoveTowards(_t, num3, Time.deltaTime / 1.2f);
					Pose();
				}
				bool flag = _t >= 0.999f;
				if ((Object)(object)walkGroup != (Object)null && walkGroup.activeSelf != flag)
				{
					walkGroup.SetActive(flag);
				}
				return;
				IL_003f:
				num2 = ((!lift) ? 1 : 0);
				goto IL_004b;
			}

			private void Pose()
			{
				//IL_0033: 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_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.SmoothStep(0f, 1f, _t);
				((Component)this).transform.localRotation = Quaternion.Slerp(((Object)(object)_hatch != (Object)null) ? _stowHatch : upperStowed, Quaternion.identity, num);
				float num2 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(_t * 1.6f));
				if ((Object)(object)knee != (Object)null)
				{
					knee.localRotation = Quaternion.AngleAxis(kneeSign * 180f * (1f - num2), new Vector3(0f, 1f, 0f));
				}
			}
		}

		internal class LadderFoldButton : GoPointerButton
		{
			internal LadderFold fold;

			public override void OnActivate(GoPointer activatingPointer)
			{
				if ((Object)(object)fold != (Object)null)
				{
					fold.Click();
				}
			}
		}

		private static readonly Spec Bow = new Spec
		{
			key = "BOW",
			hatch = "fore_hatch",
			top = new Vector3(4.46f, 0f, 0.7f),
			foot = new Vector3(3.62f, 0f, -0.8f),
			treads = 6,
			half = 0.25f,
			first = 0.1f
		};

		private static readonly Spec Stern = new Spec
		{
			key = "STERN",
			hatch = "aft_hatch",
			top = new Vector3(-3.58f, 0f, 0.44f),
			foot = new Vector3(-2.7f, 0f, -1.16f),
			treads = 6,
			half = 0.27f,
			first = 1f / 6f
		};

		private const float RailT = 0.025f;

		private const float RailD = 0.08f;

		private const float TreadD = 0.11f;

		private const float TreadT = 0.03f;

		private const float StowDown = 3f;

		private const string Name = "GALLUS_LOFT_LADDER";

		private const float KneeKeep = 0.06f;

		internal static void Apply(Transform root, Transform walk, ManualLogSource log)
		{
			int num = 0;
			foreach (Transform item in Setups(root))
			{
				Transform val = (((Object)(object)walk != (Object)null) ? FindDeep(walk, ((Object)item).name) : null);
				Material mat = PlainMaterial(item);
				Spec[] array = new Spec[2] { Bow, Stern };
				for (int i = 0; i < array.Length; i++)
				{
					Spec sp = array[i];
					GPButtonTrapdoor val2 = Hatch(item, sp.hatch);
					if (!((Object)(object)val2 == (Object)null) && !((Object)(object)item.Find("GALLUS_LOFT_LADDER_" + sp.key) != (Object)null))
					{
						GameObject walkGroup = (((Object)(object)val != (Object)null) ? BuildWalk(val, sp) : null);
						BuildSeen(item, sp, mat, walkGroup, val2, root);
						num++;
						string[] obj = new string[11]
						{
							"Gallus loft ladder: '",
							((Object)root).name,
							"' ",
							((Object)item).name,
							" ",
							sp.key.ToLower(),
							" hatch - ",
							null,
							null,
							null,
							null
						};
						int treads = sp.treads;
						obj[7] = treads.ToString();
						obj[8] = " treads, stows under the hatch and works with it";
						obj[9] = (((Object)(object)val != (Object)null) ? ", walkable" : ", NO walk copy found (seen only)");
						obj[10] = ".";
						log.LogInfo((object)string.Concat(obj));
					}
				}
				if ((Object)(object)Hatch(item, Stern.hatch) != (Object)null)
				{
					PutAwayStockStairs(item, val, log);
				}
			}
			if (num == 0)
			{
				log.LogWarning((object)("Gallus loft ladder: no hatches found on '" + ((Object)root).name + "' - no ladders."));
			}
		}

		private static void PutAwayStockStairs(Transform setup, Transform walkSetup, ManualLogSource log)
		{
			int num = 0;
			MeshRenderer[] componentsInChildren = ((Component)setup).GetComponentsInChildren<MeshRenderer>(true);
			foreach (MeshRenderer val in componentsInChildren)
			{
				MeshFilter component = ((Component)val).GetComponent<MeshFilter>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null && ((Object)component.sharedMesh).name.StartsWith("GAL_stairs"))
				{
					((Renderer)val).enabled = false;
					num++;
				}
			}
			if ((Object)(object)walkSetup != (Object)null)
			{
				Collider[] componentsInChildren2 = ((Component)walkSetup).GetComponentsInChildren<Collider>(true);
				foreach (Collider val2 in componentsInChildren2)
				{
					MeshCollider val3 = (MeshCollider)(object)((val2 is MeshCollider) ? val2 : null);
					if (((Object)(object)val3 != (Object)null && (Object)(object)val3.sharedMesh != (Object)null && ((Object)val3.sharedMesh).name.StartsWith("GAL_stairs")) || ((Object)((Component)val2).gameObject).name == "GALLUS_HOLDFIX_RAMP")
					{
						val2.enabled = false;
						num++;
					}
				}
			}
			log.LogInfo((object)("Gallus loft ladder: " + ((Object)setup).name + " - her stock stern stairs and the foot ramp put away (" + num + " part(s))."));
		}

		private static GPButtonTrapdoor Hatch(Transform setup, string key)
		{
			string text = (((Object)setup).name.EndsWith("pleasure") ? "_P_" : (((Object)setup).name.EndsWith("fisher") ? "_F_" : ""));
			GPButtonTrapdoor[] componentsInChildren = ((Component)setup.root).GetComponentsInChildren<GPButtonTrapdoor>(true);
			foreach (GPButtonTrapdoor val in componentsInChildren)
			{
				if ((Object)(object)val != (Object)null && ((Object)((Component)val).gameObject).name.Contains(key) && (text == "" || ((Object)((Component)val).gameObject).name.Contains(text)))
				{
					return val;
				}
			}
			return null;
		}

		private static List<Transform> Setups(Transform root)
		{
			List<Transform> list = new List<Transform>();
			Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if (!((Object)val).name.StartsWith("SETUP "))
				{
					continue;
				}
				bool flag = false;
				Transform val2 = val;
				while ((Object)(object)val2 != (Object)null)
				{
					if (((Object)val2).name.StartsWith("WALK "))
					{
						flag = true;
					}
					val2 = val2.parent;
				}
				if (!flag)
				{
					list.Add(val);
				}
			}
			return list;
		}

		private static Transform FindDeep(Transform t, string name)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if (((Object)t).name == name)
			{
				return t;
			}
			foreach (Transform item in t)
			{
				Transform val = FindDeep(item, name);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			return null;
		}

		private static Material PlainMaterial(Transform setup)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer[] componentsInChildren = ((Component)setup.root).GetComponentsInChildren<MeshRenderer>(true);
			foreach (MeshRenderer val in componentsInChildren)
			{
				if ((Object)(object)val != (Object)null && ((Object)((Component)val).gameObject).name == "GAL_trim" && (Object)(object)((Renderer)val).sharedMaterial != (Object)null)
				{
					Material val2 = new Material(((Renderer)val).sharedMaterial)
					{
						name = "GAL_loft_ladder_plain"
					};
					val2.mainTexture = null;
					if (val2.HasProperty("_Color"))
					{
						val2.color = new Color(0.45f, 0.32f, 0.22f);
					}
					return val2;
				}
			}
			return null;
		}

		private static Vector3 Along(Spec sp)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = sp.top - sp.foot;
			return ((Vector3)(ref val)).normalized;
		}

		private static Vector3 Depth(Spec sp)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Along(sp);
			return new Vector3(0f - val.z, 0f, val.x);
		}

		private static List<Box> Section(Spec sp, float s0, float s1, bool forWalk, bool rails = true)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: 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_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: 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_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: 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_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			List<Box> list = new List<Box>();
			Vector3 a = Along(sp);
			Vector3 d = Depth(sp);
			Vector3 b = default(Vector3);
			((Vector3)(ref b))..ctor(0f, 1f, 0f);
			Vector3 val = sp.foot + (sp.top - sp.foot) * s0;
			Vector3 val2 = sp.foot + (sp.top - sp.foot) * s1;
			Vector3 val3 = val2 - val;
			float num = ((Vector3)(ref val3)).magnitude * 0.5f;
			if (!forWalk && rails)
			{
				float[] array = new float[2] { -1f, 1f };
				foreach (float num2 in array)
				{
					list.Add(new Box
					{
						c = (val + val2) * 0.5f + new Vector3(0f, num2 * (sp.half + 0.0125f), 0f),
						a = a,
						b = b,
						d = d,
						h = new Vector3(num, 0.0125f, 0.04f)
					});
				}
			}
			float num3 = Mathf.Sign(sp.top.x - sp.foot.x);
			for (int j = 0; j < sp.treads; j++)
			{
				float num4 = sp.first + (float)j * (1f - sp.first) / (float)Mathf.Max(1, sp.treads - 1);
				if (!(num4 <= s0 + 0.0001f) && !(num4 > s1 + 0.0001f))
				{
					Vector3 val4 = sp.foot + (sp.top - sp.foot) * num4;
					float num5 = (forWalk ? 0.24f : 0.11f);
					float num6 = (forWalk ? (val4.x - 0.04f * num3) : val4.x);
					list.Add(new Box
					{
						c = new Vector3(num6, 0f, val4.z - 0.015f),
						a = Vector3.right,
						b = b,
						d = new Vector3(0f, 0f, 1f),
						h = new Vector3(num5 * 0.5f, sp.half, 0.015f)
					});
				}
			}
			return list;
		}

		private static void BuildSeen(Transform setup, Spec sp, Material mat, GameObject walkGroup, GPButtonTrapdoor door, Transform boat)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: 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_0218: 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_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: 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_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: 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_0270: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("GALLUS_LOFT_LADDER_" + sp.key);
			val.layer = ((Component)setup).gameObject.layer;
			val.transform.SetParent(setup, false);
			val.transform.localPosition = sp.top;
			Vector3 val2 = sp.foot - sp.top;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = (float)Math.PI / 60f;
			Vector3 val3 = default(Vector3);
			((Vector3)(ref val3))..ctor(Mathf.Sign(normalized.x) * Mathf.Cos(num), 0f, 0f - Mathf.Sin(num));
			Quaternion val4 = Quaternion.FromToRotation(normalized, val3);
			Vector3 val5 = Depth(sp);
			if ((val4 * val5).z > 0f)
			{
				val5 = -val5;
			}
			GameObject val6 = MeshPiece(val.transform, "GALLUS_LOFT_LADDER_" + sp.key + "_UPPER", sp.top, Section(sp, 0.5f, 1f, forWalk: false), mat);
			Vector3 val7 = sp.foot + (sp.top - sp.foot) * 0.5f + val5 * 0.08f;
			GameObject val8 = new GameObject("GALLUS_LOFT_LADDER_" + sp.key + "_KNEE");
			val8.layer = ((Component)setup).gameObject.layer;
			val8.transform.SetParent(val.transform, false);
			val8.transform.localPosition = val7 - sp.top;
			GameObject val9 = MeshPiece(val8.transform, "GALLUS_LOFT_LADDER_" + sp.key + "_LOWER", val7, Section(sp, 0f, 0.5f, forWalk: false), mat);
			LadderFold ladderFold = val.AddComponent<LadderFold>();
			ladderFold.walkGroup = walkGroup;
			ladderFold.knee = val8.transform;
			ladderFold.door = door;
			ladderFold.upperStowed = val4;
			ladderFold.hang = normalized;
			ladderFold.kneeStowed = Quaternion.AngleAxis(180f, new Vector3(0f, 1f, 0f));
			Vector3 val10 = default(Vector3);
			((Vector3)(ref val10))..ctor(0f, 1f, 0f);
			Quaternion val11 = Quaternion.Slerp(val4, Quaternion.identity, 0.22f);
			float z = (val11 * (Quaternion.AngleAxis(90f, val10) * normalized)).z;
			float z2 = (val11 * (Quaternion.AngleAxis(-90f, val10) * normalized)).z;
			ladderFold.kneeSign = ((z < z2) ? 1f : (-1f));
			GameObject val12 = null;
			if (sp.key == Stern.key)
			{
				List<Box> list = Section(sp, 0.44f, 0.5f, forWalk: false, rails: false);
				if (list.Count > 0)
				{
					val12 = MeshPiece(val.transform, "GALLUS_LOFT_LADDER_" + sp.key + "_RUNG", sp.top, list, mat);
					val12.SetActive(false);
				}
				ladderFold.boat = boat;
				ladderFold.rung = val12;
				ladderFold.lowerWalk = new List<GameObject>();
				if ((Object)(object)walkGroup != (Object)null)
				{
					for (int i = 0; i < sp.treads && i < walkGroup.transform.childCount; i++)
					{
						if (sp.first + (float)i * (1f - sp.first) / (float)Mathf.Max(1, sp.treads - 1) <= 0.44009998f)
						{
							ladderFold.lowerWalk.Add(((Component)walkGroup.transform.GetChild(i)).gameObject);
						}
					}
				}
			}
			GameObject[] array = (GameObject[])(object)new GameObject[3] { val6, val9, val12 };
			foreach (GameObject val13 in array)
			{
				if (!((Object)(object)val13 == (Object)null))
				{
					LadderFoldButton ladderFoldButton = val13.AddComponent<LadderFoldButton>();
					if ((Object)(object)ladderFoldButton != (Object)null)
					{
						((GoPointerButton)ladderFoldButton).lookText = "";
						((GoPointerButton)ladderFoldButton).description = "";
						ladderFoldButton.fold = ladderFold;
					}
				}
			}
		}

		private static GameObject MeshPiece(Transform parent, string name, Vector3 origin, List<Box> boxes, Material mat)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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)
			GameObject val = new GameObject(name);
			val.layer = ((Component)parent).gameObject.layer;
			val.transform.SetParent(parent, false);
			List<Vector3> list = new List<Vector3>();
			List<Vector3> list2 = new List<Vector3>();
			List<Vector2> list3 = new List<Vector2>();
			List<int> list4 = new List<int>();
			foreach (Box box in boxes)
			{
				Box current = box;
				ref Vector3 c = ref current.c;
				c -= origin;
				AddBox(current, list, list2, list3, list4);
			}
			Mesh val2 = new Mesh
			{
				name = "GAL_loft_ladder"
			};
			val2.SetVertices(list);
			val2.SetNormals(list2);
			val2.SetUVs(0, list3);
			val2.SetTriangles(list4, 0);
			val2.RecalculateBounds();
			val.AddComponent<MeshFilter>().sharedMesh = val2;
			MeshRenderer val3 = val.AddComponent<MeshRenderer>();
			if ((Object)(object)mat != (Object)null)
			{
				((Renderer)val3).sharedMaterial = mat;
			}
			BoxCollider obj = val.AddComponent<BoxCollider>();
			Bounds bounds = val2.bounds;
			obj.center = ((Bounds)(ref bounds)).center;
			bounds = val2.bounds;
			obj.size = ((Bounds)(ref bounds)).size + new Vector3(0.04f, 0.04f, 0.04f);
			((Collider)obj).isTrigger = true;
			return val;
		}

		internal static LadderFold SternLadder(Transform boat)
		{
			if ((Object)(object)boat == (Object)null)
			{
				return null;
			}
			LadderFold[] componentsInChildren = ((Component)boat).GetComponentsInChildren<LadderFold>(false);
			foreach (LadderFold ladderFold in componentsInChildren)
			{
				if ((Object)(object)ladderFold != (Object)null && (Object)(object)ladderFold.boat == (Object)(object)boat)
				{
					return ladderFold;
				}
			}
			return null;
		}

		private static GameObject BuildWalk(Transform walkSetup, Spec sp)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("GALLUS_LOFT_LADDER_" + sp.key);
			val.layer = ((Component)walkSetup).gameObject.layer;
			val.transform.SetParent(walkSetup, false);
			int num = 0;
			foreach (Box item in Section(sp, 0f, 1f, forWalk: true))
			{
				GameObject val2 = new GameObject(((Object)val).name + "_" + num++)
				{
					layer = ((Component)walkSetup).gameObject.layer
				};
				val2.transform.SetParent(val.transform, false);
				val2.transform.localPosition = item.c;
				val2.transform.localRotation = Quaternion.LookRotation(item.d, Vector3.Cross(item.d, item.a));
				val2.AddComponent<BoxCollider>().size = item.h * 2f;
			}
			return val;
		}

		private static void AddBox(Box bx, List<Vector3> P, List<Vector3> N, List<Vector2> U, List<int> T)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00cd: 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_00fc: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[3] { bx.a, bx.b, bx.d };
			float[] array2 = new float[3]
			{
				bx.h.x,
				bx.h.y,
				bx.h.z
			};
			for (int i = 0; i < 3; i++)
			{
				for (int j = -1; j <= 1; j += 2)
				{
					Vector3 val = array[i] * (float)j;
					Vector3 val2 = array[(i + 1) % 3];
					Vector3 val3 = array[(i + 2) % 3];
					float num = array2[(i + 1) % 3];
					float num2 = array2[(i + 2) % 3];
					Vector3 val4 = bx.c + val * array2[i];
					Vector3 val5 = Vector3.Cross(val2, val3);
					Vector3 normalized = ((Vector3)(ref val5)).normalized;
					int[] array3 = new int[2] { 1, -1 };
					foreach (int num3 in array3)
					{
						int count = P.Count;
						P.Add(val4 - val2 * num - val3 * num2);
						P.Add(val4 + val2 * num - val3 * num2);
						P.Add(val4 + val2 * num + val3 * num2);
						P.Add(val4 - val2 * num + val3 * num2);
						for (int l = 0; l < 4; l++)
						{
							N.Add(normalized * (float)num3);
						}
						U.Add(new Vector2(0f, 0f));
						U.Add(new Vector2(num * 2f / 1.2f, 0f));
						U.Add(new Vector2(num * 2f / 1.2f, num2 * 2f / 1.2f));
						U.Add(new Vector2(0f, num2 * 2f / 1.2f));
						if (num3 > 0)
						{
							T.Add(count);
							T.Add(count + 1);
							T.Add(count + 2);
							T.Add(count);
							T.Add(count + 2);
							T.Add(count + 3);
						}
						else
						{
							T.Add(count);
							T.Add(count + 2);
							T.Add(count + 1);
							T.Add(count);
							T.Add(count + 3);
							T.Add(count + 2);
						}
					}
				}
			}
		}
	}
	public class GallusCalm : MonoBehaviour
	{
		internal static ManualLogSource Log;

		private const float Seconds = 8f;

		private const float JumpMetres = 5f;

		private const float MaxRise = 1f;

		private const float MaxSink = 3f;

		private const float CalmDrag = 3f;

		private Rigidbody _rb;

		private Vector3 _lastLocal;

		private bool _haveLast;

		private bool _calming;

		private float _calmUntil;

		private float _nextLogAt;

		private float _calmStart;

		private float _drag;

		private float _angDrag;

		private void Awake()
		{
			_rb = ((Component)this).GetComponent<Rigidbody>();
		}

		private void FixedUpdate()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_00f0: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: 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)
			if ((Object)(object)_rb == (Object)null)
			{
				return;
			}
			Vector3 localPosition = ((Component)this).transform.localPosition;
			if (!_haveLast)
			{
				_haveLast = true;
				_lastLocal = localPosition;
				Begin("she has just been placed");
				return;
			}
			Vector3 val = localPosition - _lastLocal;
			float magnitude = ((Vector3)(ref val)).magnitude;
			_lastLocal = localPosition;
			if (magnitude > 5f)
			{
				Begin("she jumped " + magnitude.ToString("F0") + " m");
			}
			if (!_calming)
			{
				return;
			}
			if (Time.time > _calmUntil)
			{
				End();
			}
			else
			{
				if (_rb.isKinematic)
				{
					return;
				}
				_rb.drag = Mathf.Max(_drag, 3f);
				_rb.angularDrag = Mathf.Max(_angDrag, 3f);
				Vector3 velocity = _rb.velocity;
				float num = Mathf.Clamp(velocity.y, -3f, 1f);
				if (num != velocity.y)
				{
					_rb.velocity = new Vector3(velocity.x, num, velocity.z);
				}
				if (Time.time >= _nextLogAt)
				{
					_nextLogAt = Time.time + 1f;
					if (Log != null)
					{
						ManualLogSource log = Log;
						string[] obj = new string[8]
						{
							"Gallus calm launch: t+",
							(Time.time - _calmStart).ToString("F0"),
							" s  height ",
							null,
							null,
							null,
							null,
							null
						};
						val = ((Component)this).transform.position;
						obj[3] = val.y.ToString("F2");
						obj[4] = " m  rising ";
						obj[5] = velocity.y.ToString("F2");
						obj[6] = " m/s";
						obj[7] = ((num != velocity.y) ? (" (capped to " + num.ToString("F2") + ")") : "");
						log.LogInfo((object)string.Concat(obj));
					}
				}
			}
		}

		private void Begin(string why)
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			if (!_calming)
			{
				_drag = _rb.drag;
				_angDrag = _rb.angularDrag;
			}
			_calming = true;
			_calmStart = Time.time;
			_calmUntil = Time.time + 8f;
			_nextLogAt = Time.time;
			if (Log != null)
			{
				Log.LogInfo((object)("Gallus calm launch: " + why + " - heavy water and a 1 m/s rise for " + 8f.ToString("F0") + " s (height " + ((Component)this).transform.position.y.ToString("F2") + " m)."));
			}
		}

		private void End()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			_calming = false;
			if ((Object)(object)_rb != (Object)null)
			{
				_rb.drag = _drag;
				_rb.angularDrag = _angDrag;
			}
			if (Log != null)
			{
				Log.LogInfo((object)("Gallus calm launch: done - settled at height " + ((Component)this).transform.position.y.ToString("F2") + " m, drag back to " + _drag.ToString("F2") + "."));
			}
		}

		private void OnDisable()
		{
			if (_calming)
			{
				End();
			}
		}
	}
	internal static class GallusCargoHatch
	{
		private class Built
		{
			public GameObject seen;

			public GameObject walk;
		}

		public class Switch : MonoBehaviour
		{
			private Transform _root;

			private int _index;

			public void Set(Transform root, int index)
			{
				_root = root;
				_index = index;
			}

			private void OnEnable()
			{
				try
				{
					if ((Object)(object)_root == (Object)null)
					{
						return;
					}
					bool flag = _index == 0;
					MeshRenderer[] componentsInChildren = ((Component)_root).GetComponentsInChildren<MeshRenderer>(true);
					foreach (MeshRenderer val in componentsInChildren)
					{
						if ((Object)(object)val != (Object)null && (((Object)((Component)val).gameObject).name == "GAL_skylight" || ((Object)((Component)val).gameObject).name == "GAL_glass") && !GallusMesh.UnderWalk(((Component)val).transform))
						{
							((Renderer)val).enabled = flag;
						}
					}
					Transform val2 = GallusMesh.WalkRoot(_root);
					int num = 0;
					Transform[] array = (Transform[])(object)new Transform[2] { _root, val2 };
					foreach (Transform val3 in array)
					{
						if (!((Object)(object)val3 != (Object)null))
						{
							continue;
						}
						Collider[] componentsInChildren2 = ((Component)val3).GetComponentsInChildren<Collider>(true);
						foreach (Collider val4 in componentsInChildren2)
						{
							if ((Object)(object)val4 != (Object)null && (((Object)((Component)val4).gameObject).name == "GAL_skylight" || ((Object)((Component)val4).gameObject).name == "GAL_glass") && GallusMesh.UnderWalk(((Component)val4).transform))
							{
								val4.enabled = flag;
								num++;
							}
						}
					}
					_bigOn[((Object)_root).GetInstanceID()] = BigHouse(_index);
					BigHole(_root, val2, BigHouse(_index));
					Companionway(_root, _index);
					if (GallusHoldFixPlugin.Log != null)
					{
						GallusHoldFixPlugin.Log.LogInfo((object)("Gallus cargo hatch: option " + _index + " on - her own skylight " + (flag ? "back" : "put away") + " (" + num + " walk collider(s)" + (((Object)(object)val2 == (Object)null) ? ", NO walk copy found" : "") + ")" + _lastHole + "."));
					}
				}
				catch (Exception ex)
				{
					Debug.LogWarning((object)("Gallus cargo hatch switch: " + ex.Message));
				}
			}
		}

		private class DashBits
		{
			public List<GameObject> open = new List<GameObject>();

			public List<GameObject> whole = new List<GameObject>();
		}

		internal class HatchButton : GoPointerButton
		{
			internal MonoBehaviour target;

			public override void OnActivate(GoPointer activatingPointer)
			{
				LidFold lidFold = target as LidFold;
				if ((Object)(object)lidFold != (Object)null)
				{
					lidFold.Click();
					return;
				}
				Batten batten = target as Batten;
				if ((Object)(object)batten != (Object)null)
				{
					batten.Click();
				}
			}
		}

		internal class LidFold : MonoBehaviour
		{
			public Transform[] hinges;

			public float[] openAngles;

			public GameObject closedWalk;

			public Vector3 axis = Vector3.right;

			public Func<bool> locked;

			public bool open;

			private float _t;

			internal void Click()
			{
				if (locked == null || !locked())
				{
					open = !open;
				}
			}

			private void Update()
			{
				float num = (open ? 1f : 0f);
				if (_t != num)
				{
					_t = Mathf.MoveTowards(_t, num, Time.deltaTime / 1f);
					Pose();
				}
				bool flag = _t <= 0.001f;
				if ((Object)(object)closedWalk != (Object)null && closedWalk.activeSelf != flag)
				{
					closedWalk.SetActive(flag);
				}
			}

			private void Pose()
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.SmoothStep(0f, 1f, _t);
				if (hinges == null)
				{
					return;
				}
				for (int i = 0; i < hinges.Length; i++)
				{
					if ((Object)(object)hinges[i] != (Object)null)
					{
						hinges[i].localRotation = Quaternion.AngleAxis(openAngles[i] * num, axis);
					}
				}
			}
		}

		internal class Batten : MonoBehaviour
		{
			public GameObject cover;

			public GameObject roll;

			public LidFold fold;

			public bool on;

			internal void Click()
			{
				if (on || !((Object)(object)fold != (Object)null) || !fold.open)
				{
					on = !on;
					if ((Object)(object)cover != (Object)null)
					{
						cover.SetActive(on);
					}
					if ((Object)(object)roll != (Object)null)
					{
						roll.SetActive(!on);
					}
				}
			}
		}

		private const float X0 = -1.32f;

		private const float X1 = 1.16f;

		private const float Y = 0.63f;

		private const float ZAft = 0.36f;

		private const float ZFore = 0.44f;

		private static readonly float[] DeckX = new float[4] { -1.28f, -0.13f, 1.12f, 1.5f };

		private static readonly float[] DeckZ = new float[4] { 0.51f, 0.53f, 0.59f, 0.605f };

		private const string Name = "GALLUS_HATCH";

		private static readonly string[] Names = new string[6] { "Tented Skylight (as built)", "Barred Butterfly Hatches", "Raised Hatch, Grating and Canvas", "Deck House Hatch", "Deck House and Companionway", "Deck House and Companionway, Portholes" };

		private static readonly int[] Price = new int[6] { 0, 120, 90, 150, 260, 210 };

		private static readonly int[] Fit = new int[6] { 0, 40, 30, 50, 80, 70 };

		private static readonly int[] Mass = new int[6] { 0, 30, 35, 40, 90, 95 };

		private const float AftX0 = -3.58f;

		private const float AftX1 = -2.48f;

		private const float AftY = 0.55f;

		private static readonly Dictionary<int, List<Built>> _built = new Dictionary<int, List<Built>>();

		private static readonly HashSet<int> _registered = new HashSet<int>();

		private static readonly Dictionary<int, LidFold[]> _companion = new Dictionary<int, LidFold[]>();

		private static readonly Dictionary<int, Vector3> _companionFace = new Dictionary<int, Vector3>();

		private static LidFold _newCompanion;

		private static Vector3 _newFace;

		private static readonly Dictionary<Mesh, Mesh> _unholed = new Dictionary<Mesh, Mesh>();

		private static readonly Dictionary<int, Dictionary<Mesh, Mesh>> _cut = new Dictionary<int, Dictionary<Mesh, Mesh>>();

		internal const float PitX0 = -5.99f;

		internal const float PitIn = 0.037f;

		internal const float PitInAft = 0.05f;

		internal const float PitInFwd = 0.04f;

		internal static readonly float[] PitBeams = new float[2] { -5.4f, -4.8f };

		private static readonly Dictionary<int, KeyValuePair<Material, Vector2>> _beamWood = new Dictionary<int, KeyValuePair<Material, Vector2>>();

		private static readonly Dictionary<int, int> _lockersOn = new Dictionary<int, int>();

		private static readonly Dictionary<int, List<DashBits>> _dash = new Dictionary<int, List<DashBits>>();

		private static readonly List<DashBits> _newDash = new List<DashBits>();

		private static readonly Dictionary<int, bool> _dashWhole = new Dictionary<int, bool>();

		private static readonly Dictionary<int, bool> _bigOn = new Dictionary<int, bool>();

		private const float HoleX0 = -3.58f;

		private const float HoleX1 = 1.2f;

		private const float HoleY = 0.68f;

		private const float ReliefX = 0.43f;

		private const float ReliefY = 0.29999998f;

		private const float BeamCutY = 0.7f;

		private static string _lastHole = "";

		private static string _holeNote = "";

		private const float FrameSink = 0.07f;

		private const float LidBevel = 0.016f;

		private static float Deck(float x)
		{
			return 0.36f + Mathf.Clamp01((x - -1.32f) / 2.48f) * 0.07999998f;
		}

		internal static float DeckTop(float x)
		{
			if (x <= DeckX[0])
			{
				return DeckZ[0];
			}
			for (int i = 0; i + 1 < DeckX.Length; i++)
			{
				if (x <= DeckX[i + 1])
				{
					return Mathf.Lerp(DeckZ[i], DeckZ[i + 1], (x - DeckX[i]) / (DeckX[i + 1] - DeckX[i]));
				}
			}
			return DeckZ[DeckZ.Length - 1] + (x - DeckX[DeckX.Length - 1]) * 0.04f;
		}

		internal static float DeckUnder(float x)
		{
			return DeckTop(x) - 0.12f;
		}

		private static List<float> DeckRun(float xa, float xb)
		{
			List<float> list = new List<float> { xa };
			float[] deckX = DeckX;
			foreach (float num in deckX)
			{
				if (num > xa + 0.05f && num < xb - 0.05f)
				{
					list.Add(num);
				}
			}
			list.Add(xb);
			return list;
		}

		private static bool BigHouse(int index)
		{
			if (index != 4)
			{
				return index == 5;
			}
			return true;
		}

		internal static bool BigHouseOn(Transform root)
		{
			bool value = default(bool);
			return (Object)(object)root != (Object)null && _bigOn.TryGetValue(((Object)root).GetInstanceID(), out value) && value;
		}

		internal static void Build(Transform root, Transform walk, string texDir, ManualLogSource log)
		{
			//IL_00d6: 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_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)root == (Object)null || _built.ContainsKey(((Object)root).GetInstanceID()))
			{
				return;
			}
			Transform val = null;
			Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true);
			foreach (Transform val2 in componentsInChildren)
			{
				if (((Object)val2).name == "SETUP pleasure" && !GallusMesh.UnderWalk(val2))
				{
					val = val2;
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				log.LogWarning((object)("Gallus cargo hatch: no 'SETUP pleasure' on '" + ((Object)root).name + "' - no hatch options."));
				return;
			}
			Transform val3 = (((Object)(object)walk != (Object)null) ? GallusMesh.FindDeep(walk, "SETUP pleasure") : null);
			if ((Object)(object)val3 == (Object)null)
			{
				log.LogWarning((object)"Gallus cargo hatch: no walk copy of 'SETUP pleasure' - the hatches will be seen only.");
			}
			Material wood = GallusMesh.PlainWood(root);
			Material val4 = GallusMesh.Glass(root);
			Material brass = GallusMesh.Colour(root, "brass2", new Color(0.86f, 0.7f, 0.3f), 0.78f, 0.8f);
			Texture2D tex = GallusDress.LoadTex("canvas.png", log);
			Material val5 = GallusMesh.Textured(root, "canvas", tex, 0.08f);
			if ((Object)(object)val5 == (Object)null)
			{
				val5 = GallusMesh.Colour(root, "canvas_plain", new Color(0.72f, 0.66f, 0.52f), 0.08f, 0f);
			}
			if ((Object)(object)val4 == (Object)null)
			{
				log.LogWarning((object)"Gallus cargo hatch: her 'GAL_glass' material not found - the panes will be plain.");
			}
			List<Built> list = new List<Built>();
			list.Add(Butterfly(val, val3, wood, val4, brass));
			list.Add(Grating(val, val3, wood, val5));
			GallusMesh.Bevel = 0.018f;
			GallusMesh.EaseLines = null;
			GallusMesh.EasedBoards = 0;
			GallusMesh.EasedEdgeCount = 0;
			try
			{
				list.Add(Greenhouse(val, val3, wood, val4, brass));
			}
			finally
			{
				GallusMesh.Bevel = 0f;
				GallusMesh.EaseLines = null;
			}
			log.LogInfo((object)("Gallus cargo hatch: the deck house hatch's outside corners eased by " + 2.1599998f.ToString("F1") + " cm - " + GallusMesh.EasedEdgeCount + " edge(s) on " + GallusMesh.EasedBoards + " board(s) lie on its named corners and its lids' upper edges; every other edge square."));
			try
			{
				Vector2 uv;
				string how;
				Material val6 = BeamLook(root, val, out uv, out how);
				_beamWood[((Object)root).GetInstanceID()] = new KeyValuePair<Material, Vector2>(val6, uv);
				LidFold[] array = new LidFold[Names.Length];
				_newDash.Clear();
				bool[] array2 = new bool[2] { false, true };
				foreach (bool flag in array2)
				{
					_newCompanion = null;
					GallusMesh.Bevel = 0.018f;
					GallusMesh.EaseLines = null;
					GallusMesh.EasedBoards = 0;
					GallusMesh.EasedEdgeCount = 0;
					try
					{
						list.Add(DeckHouse(val, val3, wood, val4, brass, val6, uv, flag ? "5" : "4", flag));
					}
					finally
					{
						GallusMesh.Bevel = 0f;
						GallusMesh.EaseLines = null;
					}
					if ((Object)(object)_newCompanion != (Object)null && list.Count < array.Length)
					{
						array[list.Count] = _newCompanion;
					}
					if (flag)
					{
						log.LogInfo((object)"Gallus cargo hatch: the deck house with portholes built - its sides are solid between sill and head with five brass-rimmed round ports a side, square windows in its forward end only.");
					}
				}
				log.LogInfo((object)("Gallus cargo hatch: the deck house and companionway's outside corners eased by " + 2.1599998f.ToString("F1") + " cm - " + GallusMesh.EasedEdgeCount + " edge(s) on " + GallusMesh.EasedBoards + " board(s) lie on its named corners (the roof's two long edges, the two raked forward corners, the companionway's two sides, and the upper edges of its lids and hatch); every other edge square."));
				log.LogInfo((object)("Gallus cargo hatch: the deck house's carlings and headers are 0.13 m deep at her size, level with her deck beams' undersides, and wear " + how + "."));
				if ((Object)(object)_newCompanion != (Object)null)
				{
					_companion[((Object)root).GetInstanceID()] = array;
					_companionFace[((Object)root).GetInstanceID()] = _newFace;
				}
				_dash[((Object)root).GetInstanceID()] = new List<DashBits>(_newDash);
				_newDash.Clear();
			}
			catch (Exception ex)
			{
				log.LogWarning((object)("Gallus cargo hatch: the deck house and companionway failed - " + ex.Message + "\n" + ex.StackTrace));
			}
			try
			{
				Material val7 = GallusMesh.Textured(root, "house_mahogany", GallusDress.LoadTex("house_mahogany.png", log), 0.12f);
				Material val8 = GallusMesh.Textured(root, "hatch_teak", GallusDress.LoadTex("hatch_teak.png", log), 0.12f);
				Material val9 = GallusMesh.Textured(root, "hatch_teak_planks", GallusDress.LoadTex("hatch_teak_planks.png", log), 0.12f);
				int num = 0;
				foreach (Built item in list)
				{
					if (!((Object)(object)item.seen != (Object)null))
					{
						continue;
					}
					MeshRenderer[] componentsInChildren2 = item.seen.GetComponentsInChildren<MeshRenderer>(true);
					foreach (MeshRenderer val10 in componentsInChildren2)
					{
						string name = ((Object)((Component)val10).gameObject).name;
						if (name.Contains("WOOD"))
						{
							Material val11 = (HouseWoodPiece(name) ? val7 : (name.Contains("_PANE") ? val9 : val8));
							if ((Object)(object)val11 != (Object)null)
							{
								((Renderer)val10).sharedMaterial = val11;
								num++;
							}
						}
					}
				}
				log.LogInfo((object)("Gallus cargo hatch: " + num + " wooden piece(s) of the hatches in their own woods - mahogany walls, boxes and coamings, the barred butterfly hatches and the grating with its battens and the canvas roll's core all mahogany, teak lids and frames on the deck houses, caulked teak panels."));
			}
			catch (Exception ex2)
			{
				log.LogWarning((object)("Gallus cargo hatch: the hatches' woods - " + ex2.Message));
			}
			foreach (Built item2 in list)
			{
				if ((Object)(object)item2.seen != (Object)null)
				{
					item2.seen.SetActive(false);
				}
				if ((Object)(object)item2.walk != (Object)null)
				{
					item2.walk.SetActive(false);
				}
			}
			_built[((Object)root).GetInstanceID()] = list;
			log.LogInfo((object)("Gallus cargo hatch: '" + ((Object)root).name + "' - " + list.Count + " hatches built: barred butterfly, raised grating and canvas, deck house hatch" + ((list.Count > 3) ? ", deck house and companionway" : "") + ((list.Count > 4) ? ", deck house and companionway with portholes" : "") + " (hidden until bought)" + (((Object)(object)val3 != (Object)null) ? ", walkable" : "") + "."));
		}

		internal static bool HouseWoodPiece(string n)
		{
			if (!n.Contains("_HOUSE") && !n.Contains("_COAMING") && !n.Contains("_BOX") && !n.Contains("_1_LEAF_"))
			{
				return n.Contains("_WOOD_2_");
			}
			return true;
		}

		internal static void Register(Transform root, Transform boat, ManualLogSource log)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			if ((Object)(object)root == (Object)null || (Object)(object)boat == (Object)null || !_built.TryGetValue(((Object)root).GetInstanceID(), out var value) || _registered.Contains(((Object)root).GetInstanceID()))
			{
				return;
			}
			BoatCustomParts component = ((Component)root).GetComponent<BoatCustomParts>();
			if (!((Object)(object)component == (Object)null) && component.availableParts != null)
			{
				_registered.Add(((Object)root).GetInstanceID());
				List<BoatPartOption> list = new List<BoatPartOption>();
				GameObject val = new GameObject("GALLUS_HATCH_0");
				val.SetActive(false);
				val.transform.SetParent(boat, false);
				list.Add(GallusMesh.InitOption(val, null, Names[0], 0, 0, 0));
				val.AddComponent<Switch>().Set(root, 0);
				for (int i = 0; i < value.Count; i++)
				{
					Built built = value[i];
					list.Add(GallusMesh.InitOption(built.seen, built.walk, Names[i + 1], Price[i + 1], Fit[i + 1], Mass[i + 1]));
					built.seen.AddComponent<Switch>().Set(root, i + 1);
				}
				component.availableParts.Add(new BoatPart
				{
					category = 1,
					activeOption = 0,
					partOptions = list
				});
				val.SetActive(true);
				log.LogInfo((object)("Gallus cargo hatch: '" + ((Object)root).name + "' offers 'Cargo Hatch' (part " + (component.availableParts.Count - 1) + ": " + string.Join(", ", Names) + ") in the shipyard."));
			}
		}

		private static void Companionway(Transform root, int index)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if (!_companion.TryGetValue(((Object)root).GetInstanceID(), out var value) || !_companionFace.TryGetValue(((Object)root).GetInstanceID(), out var value2))
			{
				return;
			}
			LidFold lidFold = ((index >= 0 && index < value.Length) ? value[index] : null);
			bool flag = (Object)(object)lidFold != (Object)null && BigHouse(index);
			int num = 0;
			GallusBowLadder.LadderFold[] componentsInChildren = ((Component)root).GetComponentsInChildren<GallusBowLadder.LadderFold>(true);
			foreach (GallusBowLadder.LadderFold ladderFold in componentsInChildren)
			{
				if (!((Object)(object)ladderFold == (Object)null) && ((Object)((Component)ladderFold).gameObject).name.EndsWith("_STERN"))
				{
					ladderFold.SetCompanionway(flag ? lidFold : null, value2);
					num++;
				}
			}
			if (num > 0)
			{
				_lastHole = _lastHole + "; the stern ladder " + (flag ? "follows the companionway hatch and stows along it, her trapdoor and its walk box put away" : "back on her trapdoor");
			}
		}

		internal static float PitX1(int mode)
		{
			if (mode != 2)
			{
				return -4.82f;
			}
			return -4.16f;
		}

		internal static float PitHalf(float x)
		{
			return 0.5612f + 0.3307f * (x + 5.99f);
		}

		internal static Vector2[] PitHole(int mode)
		{
			//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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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)
			float num = -5.9399996f;
			float num2 = PitX1(mode) - 0.04f;
			float num3 = PitHalf(num) - 0.037f;
			float num4 = PitHalf(num2) - 0.037f;
			return (Vector2[])(object)new Vector2[4]
			{
				new Vector2(num, 0f - num3),
				new Vector2(num2, 0f - num4),
				new Vector2(num2, num4),
				new Vector2(num, num3)
			};
		}

		internal static bool BeamWood(Transform root, out Material mat, out Vector2 uv)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			mat = null;
			uv = Vector2.zero;
			if ((Object)(object)root == (Object)null || !_beamWood.TryGetValue(((Object)root).GetInstanceID(), out var value) || (Object)(object)value.Key == (Object)null)
			{
				return false;
			}
			mat = value.Key;
			uv = value.Value;
			return true;
		}

		internal static void DeckLockers(Transform root, int on)
		{
			if ((Object)(object)root == (Object)null)
			{
				return;
			}
			int instanceID = ((Object)root).GetInstanceID();
			if (!_lockersOn.TryGetValue(instanceID, out var value) || value != on)
			{
				_lockersOn[instanceID] = on;
				_bigOn.TryGetValue(instanceID, out var value2);
				_lastHole = "";
				BigHole(root, GallusMesh.WalkRoot(root), value2);
				if (GallusHoldFixPlugin.Log != null)
				{
					GallusHoldFixPlugin.Log.LogInfo((object)("Gallus cargo hatch: the stern deck pit " + on switch
					{
						2 => "cut through her deck (large: to the bulkhead's beam)", 
						1 => "cut through her deck (to the beam at -4.8)", 
						_ => "closed", 
					} + _lastHole + "."));
				}
			}
		}

		internal static void DashWhole(Transform root, bool whole)
		{
			if ((Object)(object)root == (Object)null)
			{
				return;
			}
			int instanceID = ((Object)root).GetInstanceID();
			if (_dashWhole.TryGetValue(instanceID, out var value) && value == whole)
			{
				return;
			}
			_dashWhole[instanceID] = whole;
			int num = 0;
			if (_dash.TryGetValue(instanceID, out var value2))
			{
				foreach (DashBits item in value2)
				{
					foreach (GameObject item2 in item.open)
					{
						if ((Object)(object)item2 != (Object)null && item2.activeSelf == whole)
						{
							item2.SetActive(!whole);
						}
					}
					foreach (GameObject item3 in item.whole)
					{
						if ((Object)(object)item3 != (Object)null)
						{
							if (item3.activeSelf != whole)
							{
								item3.SetActive(whole);
							}
							num++;
						}
					}
				}
			}
			_bigOn.TryGetValue(instanceID, out var value3);
			_lastHole = "";
			if (value3)
			{
				BigHole(root, GallusMesh.WalkRoot(root), on: true);
			}
			if (GallusHoldFixPlugin.Log != null)
			{
				GallusHoldFixPlugin.Log.LogInfo((object)("Gallus cargo hatch: the dash over the cockpit's doorway " + (whole ? "made whole (the bulkhead is fitted): her deck runs across it and its edge is lined right across" : "cut out for heads (no bulkhead)") + " - " + num + " lining piece(s) switched" + (value3 ? _lastHole : "; no big deck house is her hatch just now, so her deck is not touched") + "."));
			}
		}

		private static bool HoleSwap(Mesh cur, bool on, Transform meshT, Transform hullT, float kx, float ky, float halfY, Action<Mesh> set, ref int faces, bool relief = false, int lockers = 0)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: 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_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_046f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: 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_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: 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_0376: 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_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)cur == (Object)null)
			{
				return false;
			}
			Mesh val = cur;
			if (_unholed.TryGetValue(val, out var value))
			{
				cur = value;
			}
			if (on || lockers != 0)
			{
				int key = (on ? ((!relief) ? 1 : 3) : 0) | (lockers switch
				{
					2 => 8, 
					1 => 4, 
					_ => 0, 
				});
				if (!_cut.TryGetValue(key, out var value2))
				{
					value2 = new Dictionary<Mesh, Mesh>();
					_cut[key] = value2;
				}
				if (!value2.TryGetValue(cur, out var value3))
				{
					if (!cur.isReadable)
					{
						return false;
					}
					int num = 0;
					value3 = cur;
					if (on)
					{
						Vector3 val2 = meshT.InverseTransformPoint(hullT.TransformPoint(new Vector3(-3.58f * kx, (0f - halfY) * ky, 0f)));
						Vector3 val3 = meshT.InverseTransformPoint(hullT.TransformPoint(new Vector3(1.2f * kx, halfY * ky, 0f)));
						Bounds bounds = cur.bounds;
						if (Mathf.Min(val2.x, val3.x) < ((Bounds)(ref bounds)).min.x || Mathf.Max(val2.x, val3.x) > ((Bounds)(ref bounds)).max.x || Mathf.Min(val2.y, val3.y) < ((Bounds)(ref bounds)).min.y || Mathf.Max(val2.y, val3.y) > ((Bounds)(ref bounds)).max.y)
						{
							_holeNote = _holeNote + " ['" + ((Object)cur).name + "' NOT cut: footprint x " + Mathf.Min(val2.x, val3.x).ToString("F2") + ".." + Mathf.Max(val2.x, val3.x).ToString("F2") + " y " + Mathf.Min(val2.y, val3.y).ToString("F2") + ".." + Mathf.Max(val2.y, val3.y).ToString("F2") + " outside its bounds x " + ((Bounds)(ref bounds)).min.x.ToString("F2") + ".." + ((Bounds)(ref bounds)).max.x.ToString("F2") + " y " + ((Bounds)(ref bounds)).min.y.ToString("F2") + ".." + ((Bounds)(ref bounds)).max.y.ToString("F2") + "]";
							return false;
						}
						value3 = GallusScuppers.CutXY(cur, Mathf.Min(val2.x, val3.x), Mathf.Max(val2.x, val3.x), Mathf.Min(val2.y, val3.y), Mathf.Max(val2.y, val3.y), out var cutFaces);
						num += cutFaces;
						if (relief)
						{
							Vector3 val4 = meshT.InverseTransformPoint(hullT.TransformPoint(new Vector3(1.19f * kx, -0.29999998f * ky, 0f)));
							Vector3 val5 = meshT.InverseTransformPoint(hullT.TransformPoint(new Vector3(1.6300001f * kx, 0.29999998f * ky, 0f)));
							value3 = GallusScuppers.CutXY(value3, Mathf.Min(val4.x, val5.x), Mathf.Max(val4.x, val5.x), Mathf.Min(val4.y, val5.y), Mathf.Max(val4.y, val5.y), out var cutFaces2);
							num += cutFaces2;
						}
					}
					if (lockers != 0)
					{
						Vector2[] array = PitHole(lockers);
						Vector2[] array2 = (Vector2[])(object)new Vector2[array.Length];
						for (int i = 0; i < array.Length; i++)
						{
							Vector3 val6 = meshT.InverseTransformPoint(hullT.TransformPoint(new Vector3(array[i].x * kx, array[i].y * ky, 0f)));
							array2[i] = new Vector2(val6.x, val6.y);
						}
						value3 = GallusScuppers.CutConvex(value3, array2, out var cutFaces3);
						num += cutFaces3;
					}
					faces += num;
					value2[cur] = value3;
					_unholed[value3] = cur;
				}
				if ((Object)(object)value3 == (Object)(object)val)
				{
					return false;
				}
				set(value3);
				return true;
			}
			if ((Object)(object)cur == (Object)(object)val)
			{
				return false;
			}
			set(cur);
			return true;
		}

		private static void BigHole(Transform root, Transform walk, bool on)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			_lastHole = "";
			_holeNote = "";
			MeshFilter val = GallusMesh.HullFilter(root);
			if ((Object)(object)val == (Object)null)
			{
				_lastHole = "; NO hull found - hole not touched";
				return;
			}
			Bounds bounds = val.sharedMesh.bounds;
			float kx = ((Bounds)(ref bounds)).size.x / 13.59f;
			bounds = val.sharedMesh.bounds;
			float ky = ((Bounds)(ref bounds)).size.y / 3.8f;
			int faces = 0;
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			_lockersOn.TryGetValue(((Object)root).GetInstanceID(), out var value);
			_dashWhole.TryGetValue(((Object)root).GetInstanceID(), out var value2);
			MeshFilter[] componentsInChildren = ((Component)root).GetComponentsInChildren<MeshFilter>(true);
			foreach (MeshFilter val2 in componentsInChildren)
			{
				if ((Object)(object)val2 == (Object)null || (Object)(object)val2.sharedMesh == (Object)null || GallusMesh.UnderWalk(((Component)val2).transform))
				{
					continue;
				}
				MeshFilter m = val2;
				string name = ((Object)m.sharedMesh).name;
				if (name.StartsWith("GAL_deck"))
				{
					if (HoleSwap(m.sharedMesh, on, ((Component)m).transform, ((Component)val).transform, kx, ky, 0.68f, delegate(Mesh x)
					{
						m.sharedMesh = x;
					}, ref faces, !value2, value))
					{
						num++;
					}
				}
				else if ((name.StartsWith("GAL_floors") || ((Object)((Component)m).gameObject).name.StartsWith("GAL_beams")) && HoleSwap(m.sharedMesh, on, ((Component)m).transform, ((Component)val).transform, kx, ky, 0.7f, delegate(Mesh x)
				{
					m.sharedMesh = x;
				}, ref faces, relief: true, value))
				{
					num2++;
				}
			}
			MeshFilter val3 = GallusMesh.WalkHullFilter(walk);
			if ((Object)(object)walk != (Object)null && (Object)(object)val3 != (Object)null)
			{
				MeshCollider component = ((Component)val3).GetComponent<MeshCollider>();
				Mesh obj = (((Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null) ? component.sharedMesh : val3.sharedMesh);
				bounds = obj.bounds;
				float kx2 = ((Bounds)(ref bounds)).size.x / 13.59f;
				bounds = obj.bounds;
				float ky2 = ((Bounds)(ref bounds)).size.y / 3.8f;
				MeshCollider[] componentsInChildren2 = ((Component)walk).GetComponentsInChildren<MeshCollider>(true);
				foreach (MeshCollider val4 in componentsInChildren2)
				{
					MeshCollider mc = val4;
					if (!((Object)(object)mc == (Object)null) && !((Object)(object)mc.sharedMesh == (Object)null) && ((Object)mc.sharedMesh).name.StartsWith("GAL_deck") && HoleSwap(mc.sharedMesh, on, ((Component)mc).transform, ((Component)val3).transform, kx2, ky2, 0.68f, delegate(Mesh x)
					{
						mc.sharedMesh = x;
					}, ref faces, !value2, value))
					{
						num3++;
					}
				}
			}
			int num4 = 0;
			MeshRenderer[] componentsInChildren3 = ((Component)root).GetComponentsInChildren<MeshRenderer>(true);
			foreach (MeshRenderer val5 in componentsInChildren3)
			{
				if ((Object)(object)val5 != (Object)null && ((Object)((Component)val5).gameObject).name == "GAL_aft_hatchbase" && !GallusMesh.UnderWalk(((Component)val5).transform))
				{
					((Renderer)val5).enabled = !on;
				}
			}
			Transform[] array = (Transform[])(object)new Transform[2] { root, walk };
			foreach (Transform val6 in array)
			{
				if (!((Object)(object)val6 != (Object)null))
				{
					continue;
				}
				Collider[] componentsInChildren4 = ((Component)val6).GetComponentsInChildren<Collider>(true);
				foreach (Collider val7 in componentsInChildren4)
				{
					if ((Object)(object)val7 != (Object)null && ((Object)((Component)val7).gameObject).name == "GAL_aft_hatchbase" && GallusMesh.UnderWalk(((Component)val7).transform))
					{
						val7.enabled = !on;
						num4++;
					}
				}
			}
			if (num + num2 + num3 > 0 || on)
			{
				_lastHole = "; the deck house's hole " + (on ? "cut" : "closed") + ((value != 0) ? " (with the stern deck pit)" : "") + ": " + num + " deck mesh(es) seen, " + num2 + " beam mesh(es), " + num3 + " walk deck(s)" + (on ? (", " + faces + " faces recut") : "") + ", " + num4 + " aft-hatch walk collider(s) " + (on ? "off" : "on") + ((on && num3 == 0) ? (" - WALK DECK NOT CUT (" + (((Object)(object)walk == (Object)null) ? "no walk copy" : (((Object)(object)val3 == (Object)null) ? "no walk hull" : "no readable walk deck")) + ")") : "") + _holeNote;
			}
		}

		private static void FrameLining(List<GallusMesh.Box> boxes, float thick)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			List<float> list = DeckRun(-1.32f, 1.16f);
			float[] array = new float[2] { -1f, 1f };
			foreach (float num in array)
			{
				for (int j = 0; j + 1 < list.Count; j++)
				{
					boxes.Add(GallusMesh.Along(new Vector3(list[j], num * (0.63f - thick * 0.5f), DeckTop(list[j]) - 0.005f - 0.0595f), new Vector3(list[j + 1], num * (0.63f - thick * 0.5f), DeckTop(list[j + 1]) - 0.005f - 0.0595f), Vector3.forward, 0.119f, thick - 0.006f, 0.002f));
				}
			}
			array = new float[2] { -1.32f, 1.16f };
			foreach (float num2 in array)
			{
				float num3 = ((num2 < 0f) ? (-1.317f) : (1.16f - thick + 0.003f));
				float num4 = DeckTop(num2) - 0.005f;
				boxes.Add(GallusMesh.Aligned(new Vector3(num3, 0f - (0.63f - thick + 0.003f), num4 - 0.119f), new Vector3(num3 + thick - 0.006f, 0.63f - thick + 0.003f, num4)));
			}
		}

		private static void Coaming(GallusMesh.Parts seen, List<GallusMesh.Box> walkBoxes, float hc, float thick)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			float num = Deck(-1.32f) + 0.07f;
			float num2 = Deck(1.16f) + 0.07f;
			float num3 = hc - 0.07f;
			List<GallusMesh.Box> list = new List<GallusMesh.Box>();
			float[] array = new float[2] { -1f, 1f };
			foreach (float num4 in array)
			{
				list.Add(GallusMesh.Along(new Vector3(-1.32f, num4 * (0.63f - thick * 0.5f), num + num3 * 0.5f), new Vector3(1.16f, num4 * (0.63f - thick * 0.5f), num2 + num3 * 0.5f), Vector3.forward, num3, thick, 0f));
			}
			list.Add(GallusMesh.Aligned(new Vector3(-1.32f, 0f - (0.63f - thick), num), new Vector3(-1.32f + thick, 0.63f - thick, num + num3)));
			list.Add(GallusMesh.Aligned(new Vector3(1.16f - thick, 0f - (0.63f - thick), num2), new Vector3(1.16f, 0.63f - thick, num2 + num3)));
			FrameLining(list, thick);
			foreach (GallusMesh.Box item in list)
			{
				GallusMesh.AddBox(seen, item);
				walkBoxes?.Add(item);
			}
		}

		private static void BoxCoaming(GallusMesh.Parts seen, List<GallusMesh.Box> walkBoxes, float hc, float thick, out float zTop)
		{
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			float num = (DeckTop(-1.32f) + DeckUnder(1.16f)) * 0.5f;
			zTop = Mathf.Max(Deck(-1.32f), Deck(1.16f)) + hc;
			List<GallusMesh.Box> list = new List<GallusMesh.Box>();
			float[] array = new float[2] { -1f, 1f };
			foreach (float num2 in array)
			{
				list.Add(GallusMesh.Aligned(new Vector3(-1.32f, (num2 > 0f) ? (0.63f - thick) : (-0.63f), num), new Vector3(1.16f, (num2 > 0f) ? 0.63f : (-0.63f + thick), zTop)));
			}
			list.Add(GallusMesh.Aligned(new Vector3(-1.32f, 0f - (0.63f - thick), num), new Vector3(-1.32f + thick, 0.63f - thick, zTop)));
			list.Add(GallusMesh.Aligned(new Vector3(1.16f - thick, 0f - (0.63f - thick), num), new Vector3(1.16f, 0.63f - thick, zTop)));
			FrameLining(list, thick);
			foreach (GallusMesh.Box item in list)
			{
				GallusMesh.AddBox(seen, item);
				walkBoxes?.Add(item);
			}
		}

		private static GameObject Holder(Transform parent, string name)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			GameObject val = new GameObject(name)
			{
				layer = ((Component)parent).gameObject.layer
			};
			val.transform.SetParent(parent, false);
			return val;
		}

		private static GameObject Hinge(Transform parent, string name, Vector3 at)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Holder(parent, name);
			obj.transform.localPosition = at;
			return obj;
		}

		private static void Leaf(Transform hinge, string name, float xa, float xb, float yOut, float drop, float railW, float railT, Material wood, Material glass, Material brass, bool bars)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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_010d: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: 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_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: 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_02f7: 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_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: 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)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: 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_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ea: Unknown result type (might be due to invalid IL or missing references)