Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ShipHatch v1.0.0
ShipHatch.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ShipHatch")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ShipHatch")] [assembly: AssemblyTitle("ShipHatch")] [assembly: AssemblyVersion("1.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 ShipHatch { public class HatchController : MonoBehaviour { private class CutRecord { public MeshFilter Filter; public Mesh OriginalMesh; public MeshCollider Collider; public Mesh OriginalColliderMesh; public MeshRenderer Renderer; public Material[] OriginalMaterials; } public static HatchController Instance; private const float WheelDuration = 0.55f; private const float LidOpenDuration = 0.9f; private const float LidCloseDuration = 0.7f; private const float OpenAngle = 115f; private AnimatedObjectTrigger _anim; private InteractTrigger _lidTrigger; private InteractTrigger _ladderTrigger; private AudioSource _audio; private Transform _elevator; private Transform _melShip; private bool _built; private bool _fallbackNoHole; private Vector3 _holeCenterL; private float _roofYL; private float _floorYL; private float _holeHalf; private Vector3 _ladderDirL; private Vector3 _hingeDirL; private bool _lastOpen; private float _wheelT; private float _lidT; private float _lidAngleSign = 1f; private Vector3 _lidAxisL; private Transform _lidPivot; private Transform _wheel; private Light _shaftLight; private MeshRenderer[] _indicators = (MeshRenderer[])(object)new MeshRenderer[0]; private Material _matGlowGreen; private Material _matGlowRed; private bool _playedHissThisOpen; private bool _playedClankThisClose; private AudioClip _hiss; private AudioClip _clank; private AudioClip _ratchet; private readonly List<CutRecord> _cuts = new List<CutRecord>(); private static void Verbose(string msg) { if (Plugin.CfgVerbose.Value) { Plugin.Log.LogInfo((object)("[Hatch] " + msg)); } } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Plugin.Log.LogWarning((object)"A second Roof Hatch spawned; ignoring it."); ((Behaviour)this).enabled = false; return; } Instance = this; _anim = ((Component)this).GetComponent<AnimatedObjectTrigger>(); _audio = ((Component)this).GetComponentInChildren<AudioSource>(); InteractTrigger[] componentsInChildren = ((Component)this).GetComponentsInChildren<InteractTrigger>(true); foreach (InteractTrigger val in componentsInChildren) { if ((Object)(object)((Component)val).GetComponent<HatchLidMarker>() != (Object)null) { _lidTrigger = val; } else if ((Object)(object)((Component)val).GetComponent<HatchLadderMarker>() != (Object)null) { _ladderTrigger = val; } } } private void Start() { ((MonoBehaviour)this).StartCoroutine(SetupWhenReady()); } private IEnumerator SetupWhenReady() { float deadline = Time.realtimeSinceStartup + 60f; while ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)StartOfRound.Instance.elevatorTransform == (Object)null) { if (Time.realtimeSinceStartup > deadline) { yield break; } yield return null; } _elevator = StartOfRound.Instance.elevatorTransform; while ((Object)(object)_melShip == (Object)null) { _melShip = _elevator.Find("MelanieShip"); if ((Object)(object)_melShip == (Object)null) { if (Time.realtimeSinceStartup > deadline) { Plugin.Log.LogWarning((object)"Roof Hatch: the 2 Story Ship interior (\"MelanieShip\") was not found. The hatch needs MelanieMelicious' 2 Story Ship mod to deploy; nothing will be built."); yield break; } yield return (object)new WaitForSeconds(0.25f); } } float setupDeadline = Time.realtimeSinceStartup + 30f; while ((Object)(object)_melShip.Find("Catwalk1") == (Object)null && Time.realtimeSinceStartup < setupDeadline) { yield return (object)new WaitForSeconds(0.1f); } yield return null; yield return null; try { BuildEverything(); } catch (Exception ex) { Plugin.Log.LogError((object)("Roof Hatch build failed: " + ex)); } } private List<Collider> ShipColliders() { List<Collider> list = new List<Collider>(); Collider[] componentsInChildren = ((Component)_melShip).GetComponentsInChildren<Collider>(false); foreach (Collider val in componentsInChildren) { if (!val.isTrigger && val.enabled) { MeshRenderer component = ((Component)val).GetComponent<MeshRenderer>(); if (!((Object)(object)component == (Object)null) && ((Renderer)component).enabled) { list.Add(val); } } } return list; } private bool RayDownShip(List<Collider> cols, Vector3 worldFrom, float dist, out RaycastHit best) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0056: Unknown result type (might be due to invalid IL or missing references) best = default(RaycastHit); float num = float.MaxValue; Ray val = default(Ray); ((Ray)(ref val))..ctor(worldFrom, -_elevator.up); RaycastHit val2 = default(RaycastHit); foreach (Collider col in cols) { if (col.Raycast(val, ref val2, dist) && ((RaycastHit)(ref val2)).distance < num) { num = ((RaycastHit)(ref val2)).distance; best = val2; } } return num < float.MaxValue; } private float LocalY(Vector3 world) { //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) return _elevator.InverseTransformPoint(world).y; } private bool InsideXZ(Vector3 worldPoint, Bounds worldBounds, float margin) { //IL_0002: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (((Bounds)(ref worldBounds)).size == Vector3.zero) { return false; } if (Mathf.Abs(worldPoint.x - ((Bounds)(ref worldBounds)).center.x) < ((Bounds)(ref worldBounds)).extents.x + margin) { return Mathf.Abs(worldPoint.z - ((Bounds)(ref worldBounds)).center.z) < ((Bounds)(ref worldBounds)).extents.z + margin; } return false; } private void BuildEverything() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_0125: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0248: 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_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025b: 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_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: 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_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: 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_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Unknown result type (might be due to invalid IL or missing references) //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_06d8: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_070b: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Unknown result type (might be due to invalid IL or missing references) //IL_0737: Unknown result type (might be due to invalid IL or missing references) //IL_073c: Unknown result type (might be due to invalid IL or missing references) //IL_0741: Unknown result type (might be due to invalid IL or missing references) //IL_0746: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_07ca: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Unknown result type (might be due to invalid IL or missing references) //IL_07e8: Unknown result type (might be due to invalid IL or missing references) //IL_07ed: Unknown result type (might be due to invalid IL or missing references) //IL_07f8: Unknown result type (might be due to invalid IL or missing references) //IL_0803: Unknown result type (might be due to invalid IL or missing references) //IL_07d7: Unknown result type (might be due to invalid IL or missing references) //IL_07dc: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_0783: Unknown result type (might be due to invalid IL or missing references) //IL_084f: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_085e: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Unknown result type (might be due to invalid IL or missing references) //IL_079c: Unknown result type (might be due to invalid IL or missing references) //IL_0871: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_07aa: Unknown result type (might be due to invalid IL or missing references) //IL_07ac: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) Transform val = _melShip.Find("Roof0"); if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).GetComponent<MeshRenderer>() == (Object)null) { Plugin.Log.LogError((object)"Roof Hatch: Roof0 not found on MelanieShip; aborting build."); return; } Bounds bounds = ((Renderer)((Component)val).GetComponent<MeshRenderer>()).bounds; Transform val2 = _melShip.Find("RoofWindow0"); Bounds val3 = default(Bounds); if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).GetComponent<MeshRenderer>() != (Object)null && ((Component)val2).gameObject.activeInHierarchy) { val3 = ((Renderer)((Component)val2).GetComponent<MeshRenderer>()).bounds; } _holeHalf = Mathf.Clamp(Plugin.CfgHoleSize.Value, 1.2f, 2.2f) * 0.5f; Vector3 val4 = _elevator.InverseTransformPoint(((Bounds)(ref bounds)).center); float num = LocalY(new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds)).center.z)); List<Collider> cols = ShipColliders(); List<Vector2> obj = new List<Vector2> { new Vector2(3.6f + Plugin.CfgOffsetX.Value, -2.5f + Plugin.CfgOffsetZ.Value), new Vector2(3.6f, -2.5f), new Vector2(3.6f, -0.5f), new Vector2(2.2f, -2.5f), new Vector2(5f, -2.5f), new Vector2(3.6f, -4.2f), new Vector2(2.2f, 0.5f), new Vector2(5f, 0.5f), new Vector2(0.8f, -2.5f), new Vector2(3.6f, 1.8f), new Vector2(0.8f, 1.8f), new Vector2(-4.6f, -4.6f), new Vector2(-4.6f, 1.8f) }; bool flag = false; List<string> list = new List<string>(); foreach (Vector2 item in obj) { float num2 = val4.x + item.x; float num3 = val4.z + item.y; if (ValidateSpot(cols, val3, num, num2, num3, out _roofYL, out _floorYL, out var reject)) { _holeCenterL = new Vector3(num2, _roofYL, num3); flag = true; Verbose($"Placement chosen at elevator-local ({num2:F2}, {_roofYL:F2}, {num3:F2}), floor {_floorYL:F2}, offset {item}"); break; } list.Add($"({num2:F1},{num3:F1}): {reject}"); } if (!flag) { Vector3 val5 = _elevator.InverseTransformPoint(((Bounds)(ref bounds)).min); Vector3 val6 = _elevator.InverseTransformPoint(((Bounds)(ref bounds)).max); float num4 = Mathf.Min(val5.x, val6.x) + 1.2f; float num5 = Mathf.Max(val5.x, val6.x) - 1.2f; float num6 = Mathf.Min(val5.z, val6.z) + 1.2f; float num7 = Mathf.Max(val5.z, val6.z) - 1.2f; Vector2 val7 = default(Vector2); ((Vector2)(ref val7))..ctor(val4.x + 3.6f + Plugin.CfgOffsetX.Value, val4.z - 2.5f + Plugin.CfgOffsetZ.Value); float num8 = float.MaxValue; for (float num9 = num4; num9 <= num5; num9 += 0.6f) { for (float num10 = num6; num10 <= num7; num10 += 0.6f) { if (ValidateSpot(cols, val3, num, num9, num10, out var roofYL, out var floorYL, out var _)) { float num11 = Vector2.SqrMagnitude(new Vector2(num9, num10) - val7); if (num11 < num8) { num8 = num11; _holeCenterL = new Vector3(num9, roofYL, num10); _roofYL = roofYL; _floorYL = floorYL; flag = true; } } } } if (flag) { Plugin.Log.LogInfo((object)$"Roof Hatch: preferred spots rejected, grid scan placed the hatch at ({_holeCenterL.x:F2}, {_roofYL:F2}, {_holeCenterL.z:F2})."); } if (!flag) { float num12 = 31f; for (float num13 = num4; num13 <= num5; num13 += 0.6f) { for (float num14 = num6; num14 <= num7; num14 += 0.6f) { if (!RayDownShip(cols, _elevator.TransformPoint(new Vector3(num13, num + 2.5f, num14)), 8f, out var best)) { continue; } float num15 = Vector3.Angle(((RaycastHit)(ref best)).normal, _elevator.up); if (num15 >= num12) { continue; } float num16 = LocalY(((RaycastHit)(ref best)).point); if (!(num - num16 > 2.6f) && !InsideXZ(((RaycastHit)(ref best)).point, val3, _holeHalf + 0.4f) && RayDownShip(cols, _elevator.TransformPoint(new Vector3(num13, num16 - 1.7f, num14)), 6f, out var best2)) { float num17 = LocalY(((RaycastHit)(ref best2)).point); float num18 = num16 - num17; if (!(num18 < 2.4f) && !(num18 > 5.6f)) { num12 = num15; _holeCenterL = new Vector3(num13, num16, num14); _roofYL = num16; _floorYL = num17; flag = true; } } } } if (flag) { Plugin.Log.LogWarning((object)$"Roof Hatch: no ideal spot; using best-effort placement at ({_holeCenterL.x:F2}, {_roofYL:F2}, {_holeCenterL.z:F2}), roof tilt {num12:F0} deg."); } } } if (!flag) { Plugin.Log.LogError((object)("Roof Hatch: no valid roof spot found; aborting build. Candidate rejections:\n " + string.Join("\n ", list))); return; } Vector3[] obj2 = new Vector3[4] { Vector3.left, Vector3.forward, Vector3.back, Vector3.right }; _ladderDirL = Vector3.zero; Vector3[] array = (Vector3[])(object)obj2; foreach (Vector3 val8 in array) { Vector3 val9 = _holeCenterL + val8 * (_holeHalf + 0.95f); Vector3 worldFrom = _elevator.TransformPoint(new Vector3(val9.x, _roofYL + 1.5f, val9.z)); if (RayDownShip(cols, worldFrom, 3f, out var best3) && Mathf.Abs(LocalY(((RaycastHit)(ref best3)).point) - _roofYL) < 0.35f && Vector3.Angle(((RaycastHit)(ref best3)).normal, _elevator.up) < 15f && !InsideXZ(((RaycastHit)(ref best3)).point, val3, 0.3f)) { _ladderDirL = val8; break; } } if (_ladderDirL == Vector3.zero) { _ladderDirL = Vector3.left; } _hingeDirL = -_ladderDirL; Verbose($"Ladder side {_ladderDirL}, hinge side {_hingeDirL}"); try { CutHole(cols); List<Collider> cols2 = ShipColliders(); Vector3 worldFrom2 = _elevator.TransformPoint(new Vector3(_holeCenterL.x, _roofYL + 1f, _holeCenterL.z)); if (RayDownShip(cols2, worldFrom2, 5.5f, out var best4) && LocalY(((RaycastHit)(ref best4)).point) > _floorYL + 0.6f) { Plugin.Log.LogWarning((object)"Roof Hatch: shaft still obstructed after cutting; using teleport fallback."); RestoreCuts(); _fallbackNoHole = true; } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Roof Hatch: CSG cut failed (" + ex.Message + "); using teleport fallback.")); RestoreCuts(); _fallbackNoHole = true; } BuildVisuals(); ConfigureTriggers(); _built = true; Plugin.Log.LogInfo((object)("Roof Hatch deployed" + (_fallbackNoHole ? " (teleport fallback mode)" : "") + ".")); } private bool ValidateSpot(List<Collider> cols, Bounds winBounds, float roofRefTopL, float cx, float cz, out float roofYL, out float floorYL, out string reject) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_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_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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_014e: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: 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_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) roofYL = 0f; floorYL = 0f; reject = null; if (!RayDownShip(cols, From(cx, roofRefTopL + 2.5f, cz), 8f, out var best)) { reject = "no roof surface"; return false; } float num = Vector3.Angle(((RaycastHit)(ref best)).normal, _elevator.up); if (num > 18f) { reject = $"roof tilted {num:F0}deg ({((Object)((RaycastHit)(ref best)).collider).name})"; return false; } roofYL = LocalY(((RaycastHit)(ref best)).point); if (roofRefTopL - roofYL > 2.6f) { reject = "surface far below roof top (pit)"; return false; } if (InsideXZ(((RaycastHit)(ref best)).point, winBounds, _holeHalf + 0.55f)) { reject = "too close to skylight"; return false; } float num2 = _holeHalf + 0.2f; Vector2[] array = (Vector2[])(object)new Vector2[4] { new Vector2(num2, num2), new Vector2(num2, 0f - num2), new Vector2(0f - num2, num2), new Vector2(0f - num2, 0f - num2) }; foreach (Vector2 val in array) { if (!RayDownShip(cols, From(cx + val.x, roofRefTopL + 2.5f, cz + val.y), 8f, out var best2)) { reject = "roof corner missing"; return false; } if (Mathf.Abs(LocalY(((RaycastHit)(ref best2)).point) - roofYL) > 0.22f) { reject = "roof corner uneven"; return false; } if (Vector3.Angle(((RaycastHit)(ref best2)).normal, _elevator.up) > 18f) { reject = "roof corner sloped"; return false; } if (InsideXZ(((RaycastHit)(ref best2)).point, winBounds, 0.2f)) { reject = "corner over skylight"; return false; } } if (!RayDownShip(cols, From(cx, roofYL - 1.7f, cz), 6f, out var best3)) { reject = "no floor below"; return false; } floorYL = LocalY(((RaycastHit)(ref best3)).point); float num3 = roofYL - floorYL; if (num3 < 2.4f || num3 > 5.6f) { reject = $"floor gap {num3:F1}m ({((Object)((RaycastHit)(ref best3)).collider).name})"; return false; } float num4 = _holeHalf - 0.1f; array = (Vector2[])(object)new Vector2[4] { new Vector2(num4, num4), new Vector2(num4, 0f - num4), new Vector2(0f - num4, num4), new Vector2(0f - num4, 0f - num4) }; foreach (Vector2 val2 in array) { if (!RayDownShip(cols, From(cx + val2.x, roofYL - 1.7f, cz + val2.y), 6f, out var best4)) { reject = "floor corner missing"; return false; } if (Mathf.Abs(LocalY(((RaycastHit)(ref best4)).point) - floorYL) > 0.5f) { reject = "floor corner uneven"; return false; } } return true; Vector3 From(float x, float y, float z) { //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) return _elevator.TransformPoint(new Vector3(x, y, z)); } } private void CutHole(List<Collider> cols) { //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_0043: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0071: 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_0089: 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_00a1: 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_00c8: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: 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_0246: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Expected O, but got Unknown //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: 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_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) HashSet<GameObject> hashSet = new HashSet<GameObject>(); float num = _roofYL - 1.7f; float num2 = _roofYL + 0.1f; float num3 = _holeHalf * 0.85f; Vector2[] array = (Vector2[])(object)new Vector2[5] { Vector2.zero, new Vector2(num3, num3), new Vector2(num3, 0f - num3), new Vector2(0f - num3, num3), new Vector2(0f - num3, 0f - num3) }; Ray val3 = default(Ray); RaycastHit val4 = default(RaycastHit); foreach (Vector2 val in array) { Vector3 val2 = _elevator.TransformPoint(new Vector3(_holeCenterL.x + val.x, _roofYL + 2.5f, _holeCenterL.z + val.y)); ((Ray)(ref val3))..ctor(val2, -_elevator.up); foreach (Collider col in cols) { if (col.Raycast(val3, ref val4, 6f)) { float num4 = LocalY(((RaycastHit)(ref val4)).point); if (num4 >= num && num4 <= num2 && (Object)(object)((Component)col).GetComponent<MeshFilter>() != (Object)null && (Object)(object)((Component)col).GetComponent<MeshRenderer>() != (Object)null) { hashSet.Add(((Component)col).gameObject); } } } } if (hashSet.Count == 0) { throw new InvalidOperationException("no cuttable roof meshes under the hatch footprint"); } MethodInfo method = Type.GetType("UnityEngine.ProBuilder.Csg.CSG, Unity.ProBuilder.Csg", throwOnError: true).GetMethod("Subtract", BindingFlags.Static | BindingFlags.Public); GameObject val5 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val5).name = "ShipHatchCutter"; Object.Destroy((Object)(object)val5.GetComponent<Collider>()); val5.transform.position = _elevator.TransformPoint(new Vector3(_holeCenterL.x, _roofYL - 0.7f, _holeCenterL.z)); val5.transform.rotation = _elevator.rotation; val5.transform.localScale = new Vector3(_holeHalf * 2f, 2f, _holeHalf * 2f); try { foreach (GameObject item2 in hashSet) { Verbose("CSG cutting " + ((Object)item2).name); MeshFilter component = item2.GetComponent<MeshFilter>(); MeshRenderer component2 = item2.GetComponent<MeshRenderer>(); MeshCollider component3 = item2.GetComponent<MeshCollider>(); ((Renderer)val5.GetComponent<MeshRenderer>()).sharedMaterial = ((Renderer)component2).sharedMaterials[0]; object obj = method.Invoke(null, new object[2] { item2, val5 }); Type type = obj.GetType(); Mesh val6 = (Mesh)type.GetProperty("mesh").GetValue(obj); List<Material> list = (List<Material>)type.GetProperty("materials").GetValue(obj); Matrix4x4 worldToLocalMatrix = item2.transform.worldToLocalMatrix; Matrix4x4 localToWorldMatrix = item2.transform.localToWorldMatrix; Matrix4x4 transpose = ((Matrix4x4)(ref localToWorldMatrix)).transpose; Vector3[] vertices = val6.vertices; for (int j = 0; j < vertices.Length; j++) { vertices[j] = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyPoint3x4(vertices[j]); } val6.vertices = vertices; Vector3[] normals = val6.normals; if (normals != null && normals.Length == vertices.Length) { for (int k = 0; k < normals.Length; k++) { int num5 = k; Vector3 val7 = Vector4.op_Implicit(transpose * Vector4.op_Implicit(normals[k])); normals[num5] = ((Vector3)(ref val7)).normalized; } val6.normals = normals; } val6.RecalculateBounds(); ((Object)val6).name = ((Object)item2).name + "_Hatched"; CutRecord item = new CutRecord { Filter = component, OriginalMesh = component.sharedMesh, Renderer = component2, OriginalMaterials = ((Renderer)component2).sharedMaterials, Collider = component3, OriginalColliderMesh = (((Object)(object)component3 != (Object)null) ? component3.sharedMesh : null) }; _cuts.Add(item); component.sharedMesh = val6; ((Renderer)component2).sharedMaterials = list.ToArray(); if ((Object)(object)component3 != (Object)null) { component3.sharedMesh = val6; } } } finally { Object.Destroy((Object)(object)val5); } } private void RestoreCuts() { foreach (CutRecord cut in _cuts) { try { if ((Object)(object)cut.Filter != (Object)null) { cut.Filter.sharedMesh = cut.OriginalMesh; } if ((Object)(object)cut.Renderer != (Object)null) { ((Renderer)cut.Renderer).sharedMaterials = cut.OriginalMaterials; } if ((Object)(object)cut.Collider != (Object)null) { cut.Collider.sharedMesh = cut.OriginalColliderMesh; } } catch { } } _cuts.Clear(); } private void BuildVisuals() { //IL_0005: 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_0050: 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_0098: 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_00e0: 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) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_014a: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_0e94: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0229: 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_023e: 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_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_073a: Expected O, but got Unknown //IL_074f: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_075b: Unknown result type (might be due to invalid IL or missing references) //IL_0760: Unknown result type (might be due to invalid IL or missing references) //IL_0765: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Unknown result type (might be due to invalid IL or missing references) //IL_0777: Unknown result type (might be due to invalid IL or missing references) //IL_078f: Unknown result type (might be due to invalid IL or missing references) //IL_0794: Unknown result type (might be due to invalid IL or missing references) //IL_0796: Unknown result type (might be due to invalid IL or missing references) //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_079f: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07b0: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_07ba: Unknown result type (might be due to invalid IL or missing references) //IL_07bc: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_038d: 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_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0325: 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_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Unknown result type (might be due to invalid IL or missing references) //IL_07ea: Expected O, but got Unknown //IL_0804: Unknown result type (might be due to invalid IL or missing references) //IL_080e: Unknown result type (might be due to invalid IL or missing references) //IL_0835: Unknown result type (might be due to invalid IL or missing references) //IL_083a: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Unknown result type (might be due to invalid IL or missing references) //IL_0872: Unknown result type (might be due to invalid IL or missing references) //IL_0877: Unknown result type (might be due to invalid IL or missing references) //IL_0881: Unknown result type (might be due to invalid IL or missing references) //IL_0886: Unknown result type (might be due to invalid IL or missing references) //IL_088b: Unknown result type (might be due to invalid IL or missing references) //IL_088d: Unknown result type (might be due to invalid IL or missing references) //IL_0891: Unknown result type (might be due to invalid IL or missing references) //IL_08aa: Unknown result type (might be due to invalid IL or missing references) //IL_08b4: Unknown result type (might be due to invalid IL or missing references) //IL_08b9: Unknown result type (might be due to invalid IL or missing references) //IL_08c3: Unknown result type (might be due to invalid IL or missing references) //IL_08c8: Unknown result type (might be due to invalid IL or missing references) //IL_08cd: Unknown result type (might be due to invalid IL or missing references) //IL_08cf: Unknown result type (might be due to invalid IL or missing references) //IL_08d3: Unknown result type (might be due to invalid IL or missing references) //IL_08ec: Unknown result type (might be due to invalid IL or missing references) //IL_08f6: Unknown result type (might be due to invalid IL or missing references) //IL_08fb: Unknown result type (might be due to invalid IL or missing references) //IL_0905: Unknown result type (might be due to invalid IL or missing references) //IL_090a: Unknown result type (might be due to invalid IL or missing references) //IL_090f: Unknown result type (might be due to invalid IL or missing references) //IL_0914: Unknown result type (might be due to invalid IL or missing references) //IL_0918: Unknown result type (might be due to invalid IL or missing references) //IL_0932: Unknown result type (might be due to invalid IL or missing references) //IL_093c: Unknown result type (might be due to invalid IL or missing references) //IL_0941: Unknown result type (might be due to invalid IL or missing references) //IL_094b: Unknown result type (might be due to invalid IL or missing references) //IL_0950: Unknown result type (might be due to invalid IL or missing references) //IL_0955: Unknown result type (might be due to invalid IL or missing references) //IL_095a: Unknown result type (might be due to invalid IL or missing references) //IL_095e: Unknown result type (might be due to invalid IL or missing references) //IL_0970: Unknown result type (might be due to invalid IL or missing references) //IL_0977: Expected O, but got Unknown //IL_0992: Unknown result type (might be due to invalid IL or missing references) //IL_099c: Unknown result type (might be due to invalid IL or missing references) //IL_09bf: Unknown result type (might be due to invalid IL or missing references) //IL_09c4: Unknown result type (might be due to invalid IL or missing references) //IL_09d8: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: 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_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_040f: 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_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_044a: 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_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0a00: Unknown result type (might be due to invalid IL or missing references) //IL_0a05: Unknown result type (might be due to invalid IL or missing references) //IL_0a0a: Unknown result type (might be due to invalid IL or missing references) //IL_0a0f: Unknown result type (might be due to invalid IL or missing references) //IL_0a1d: Unknown result type (might be due to invalid IL or missing references) //IL_0a24: Unknown result type (might be due to invalid IL or missing references) //IL_0a35: Unknown result type (might be due to invalid IL or missing references) //IL_0a49: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: 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_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0a8e: Unknown result type (might be due to invalid IL or missing references) //IL_0a93: Unknown result type (might be due to invalid IL or missing references) //IL_0a98: Unknown result type (might be due to invalid IL or missing references) //IL_0a9d: Unknown result type (might be due to invalid IL or missing references) //IL_0aab: Unknown result type (might be due to invalid IL or missing references) //IL_0aaf: Unknown result type (might be due to invalid IL or missing references) //IL_0ac6: Unknown result type (might be due to invalid IL or missing references) //IL_0ae7: Unknown result type (might be due to invalid IL or missing references) //IL_0b10: Unknown result type (might be due to invalid IL or missing references) //IL_0b1a: Unknown result type (might be due to invalid IL or missing references) //IL_0b1f: Unknown result type (might be due to invalid IL or missing references) //IL_0b24: Unknown result type (might be due to invalid IL or missing references) //IL_0b26: Unknown result type (might be due to invalid IL or missing references) //IL_0b40: Unknown result type (might be due to invalid IL or missing references) //IL_0b4a: Unknown result type (might be due to invalid IL or missing references) //IL_0b4f: Unknown result type (might be due to invalid IL or missing references) //IL_0b56: Unknown result type (might be due to invalid IL or missing references) //IL_0b5b: Unknown result type (might be due to invalid IL or missing references) //IL_0b60: Unknown result type (might be due to invalid IL or missing references) //IL_0b74: Unknown result type (might be due to invalid IL or missing references) //IL_0b8d: Unknown result type (might be due to invalid IL or missing references) //IL_0b97: Unknown result type (might be due to invalid IL or missing references) //IL_0b9c: Unknown result type (might be due to invalid IL or missing references) //IL_0ba3: Unknown result type (might be due to invalid IL or missing references) //IL_0ba8: Unknown result type (might be due to invalid IL or missing references) //IL_0bad: Unknown result type (might be due to invalid IL or missing references) //IL_0bc1: Unknown result type (might be due to invalid IL or missing references) //IL_0bd9: Unknown result type (might be due to invalid IL or missing references) //IL_0be7: Unknown result type (might be due to invalid IL or missing references) //IL_0bf9: Unknown result type (might be due to invalid IL or missing references) //IL_0bfb: Unknown result type (might be due to invalid IL or missing references) //IL_0c08: Unknown result type (might be due to invalid IL or missing references) //IL_0c0d: Unknown result type (might be due to invalid IL or missing references) //IL_0c12: Unknown result type (might be due to invalid IL or missing references) //IL_0c1c: Unknown result type (might be due to invalid IL or missing references) //IL_0c21: Unknown result type (might be due to invalid IL or missing references) //IL_0c26: Unknown result type (might be due to invalid IL or missing references) //IL_0c33: Unknown result type (might be due to invalid IL or missing references) //IL_0c38: Unknown result type (might be due to invalid IL or missing references) //IL_0c3d: Unknown result type (might be due to invalid IL or missing references) //IL_0c42: Unknown result type (might be due to invalid IL or missing references) //IL_0c4c: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_0c73: Unknown result type (might be due to invalid IL or missing references) //IL_0c75: Unknown result type (might be due to invalid IL or missing references) //IL_0c7f: Unknown result type (might be due to invalid IL or missing references) //IL_0c84: Unknown result type (might be due to invalid IL or missing references) //IL_0c89: Unknown result type (might be due to invalid IL or missing references) //IL_0c93: Unknown result type (might be due to invalid IL or missing references) //IL_0c98: Unknown result type (might be due to invalid IL or missing references) //IL_0c9d: Unknown result type (might be due to invalid IL or missing references) //IL_0ca2: Unknown result type (might be due to invalid IL or missing references) //IL_0cac: Unknown result type (might be due to invalid IL or missing references) //IL_0cc5: Unknown result type (might be due to invalid IL or missing references) //IL_0cc7: Unknown result type (might be due to invalid IL or missing references) //IL_0cd1: Unknown result type (might be due to invalid IL or missing references) //IL_0cd6: Unknown result type (might be due to invalid IL or missing references) //IL_0cdb: Unknown result type (might be due to invalid IL or missing references) //IL_0ce5: Unknown result type (might be due to invalid IL or missing references) //IL_0cea: Unknown result type (might be due to invalid IL or missing references) //IL_0cef: Unknown result type (might be due to invalid IL or missing references) //IL_0d03: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_05ed: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06c3: Unknown result type (might be due to invalid IL or missing references) //IL_06d7: Unknown result type (might be due to invalid IL or missing references) //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_0701: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_0ddb: Unknown result type (might be due to invalid IL or missing references) //IL_0ddd: Unknown result type (might be due to invalid IL or missing references) //IL_0de7: Unknown result type (might be due to invalid IL or missing references) //IL_0dec: Unknown result type (might be due to invalid IL or missing references) //IL_0e24: Unknown result type (might be due to invalid IL or missing references) //IL_0d82: Unknown result type (might be due to invalid IL or missing references) //IL_0d88: Invalid comparison between Unknown and I4 Transform transform = new GameObject("HatchVisuals").transform; transform.SetParent(((Component)this).transform, false); Material mat = ProcAssets.Metal(new Color(0.3f, 0.32f, 0.36f), 0.85f, 0.5f); Material mat2 = ProcAssets.Metal(new Color(0.22f, 0.24f, 0.28f), 0.85f, 0.55f); Material val = ProcAssets.Metal(new Color(0.12f, 0.12f, 0.13f), 0.6f, 0.35f); Material val2 = ProcAssets.Metal(new Color(0.95f, 0.72f, 0.05f), 0.4f, 0.45f); Material mat3 = ProcAssets.Hazard(); Material mat4 = ProcAssets.TreadPlate(); _matGlowGreen = ProcAssets.Emissive(new Color(0.1f, 0.3f, 0.12f), new Color(0.2f, 1f, 0.25f), 350f); _matGlowRed = ProcAssets.Emissive(new Color(0.3f, 0.1f, 0.1f), new Color(1f, 0.15f, 0.1f), 350f); Vector3 holeCenterL = _holeCenterL; float holeHalf = _holeHalf; Vector3 ladderDirL = _ladderDirL; Vector3 hingeDirL = _hingeDirL; Vector3 val3 = Vector3.Cross(Vector3.up, ladderDirL); Vector3 normalized = ((Vector3)(ref val3)).normalized; float num = 0.2f; float num2 = 0.22f; Vector3[] array = (Vector3[])(object)new Vector3[4] { ladderDirL, hingeDirL, normalized, -normalized }; foreach (Vector3 val4 in array) { Vector3 val5 = holeCenterL + val4 * (holeHalf + num / 2f) + Vector3.up * (num2 / 2f - 0.02f); Vector3 val6 = SideBoxSize(val4, num, num2, holeHalf * 2f + num * 2f); ProcAssets.Part(transform, (PrimitiveType)3, "Collar", val5, Vector3.zero, val6, mat); ProcAssets.Part(transform, (PrimitiveType)3, "CollarHazard", val5 + Vector3.up * (num2 / 2f + 0.004f), Vector3.zero, SideBoxSize(val4, num - 0.04f, 0.01f, holeHalf * 2f + num * 2f - 0.04f), mat3); ProcAssets.SolidBox(transform, "CollarPhys", val5, val6); } float[] array2 = new float[2] { 1f, -1f }; foreach (float num3 in array2) { float[] array3 = new float[2] { 1f, -1f }; foreach (float num4 in array3) { Vector3 localPos = holeCenterL + new Vector3(num3 * (holeHalf + num / 2f), num2 - 0.02f, num4 * (holeHalf + num / 2f)); ProcAssets.Part(transform, (PrimitiveType)0, "Bolt", localPos, Vector3.zero, Vector3.one * 0.09f, val); } } if (!_fallbackNoHole) { float num5 = 1.38f; float num6 = 0.03f; array = (Vector3[])(object)new Vector3[4] { ladderDirL, hingeDirL, normalized, -normalized }; foreach (Vector3 val7 in array) { Vector3 localPos2 = holeCenterL + val7 * (holeHalf - num6 / 2f) + Vector3.up * (0.16f - num5 / 2f); Vector3 val8 = SideBoxSize(val7, num6, num5, holeHalf * 2f - 0.002f); ProcAssets.Part(transform, (PrimitiveType)3, "ShaftLiner", localPos2, Vector3.zero, val8, mat4); ProcAssets.SolidBox(transform, "ShaftPhys", localPos2, val8); } Vector3 val9 = holeCenterL + ladderDirL * (holeHalf - 0.1f); float num7 = _roofYL - 0.06f; float num8 = num7 - _floorYL; array2 = new float[2] { 1f, -1f }; foreach (float num9 in array2) { Vector3 localPos3 = new Vector3(val9.x, _floorYL + num8 / 2f, val9.z) + normalized * (0.31f * num9); ProcAssets.Part(transform, (PrimitiveType)3, "LadderRail", localPos3, Vector3.zero, new Vector3(0.055f, num8, 0.055f), mat); } Vector3 localEuler = ((Mathf.Abs(normalized.z) > 0.5f) ? new Vector3(90f, 0f, 0f) : new Vector3(0f, 0f, 90f)); int num10 = 0; int num11 = Mathf.FloorToInt((num7 - 0.15f - (_floorYL + 0.28f)) / 0.28f) + 1; float num12 = _floorYL + 0.28f; while (num12 <= num7 - 0.12f) { bool flag = num10 >= num11 - 2; ProcAssets.Part(transform, (PrimitiveType)2, "Rung", new Vector3(val9.x, num12, val9.z), localEuler, new Vector3(0.045f, 0.3f, 0.045f), flag ? val2 : val); num12 += 0.28f; num10++; } Vector3 val10 = holeCenterL + ladderDirL * (holeHalf - 0.45f); ProcAssets.Part(transform, (PrimitiveType)3, "LandingPlate", new Vector3(val10.x, _floorYL + 0.012f, val10.z), Vector3.zero, new Vector3(1f, 0.022f, 1f), mat3); array2 = new float[2] { 1f, -1f }; foreach (float num13 in array2) { Vector3 val11 = holeCenterL + ladderDirL * (holeHalf + num / 2f) + normalized * ((holeHalf + num / 2f) * num13); ProcAssets.Part(transform, (PrimitiveType)2, "GrabPost", val11 + Vector3.up * 0.5f, Vector3.zero, new Vector3(0.06f, 0.42f, 0.06f), val2); ProcAssets.Part(transform, (PrimitiveType)0, "GrabKnob", val11 + Vector3.up * 0.95f, Vector3.zero, Vector3.one * 0.085f, val2); } } GameObject val12 = new GameObject("LidPivot"); val12.transform.SetParent(transform, false); val12.transform.localPosition = holeCenterL + hingeDirL * (holeHalf + 0.1f) + Vector3.up * (num2 - 0.005f); _lidPivot = val12.transform; val3 = Vector3.Cross(Vector3.up, hingeDirL); _lidAxisL = ((Vector3)(ref val3)).normalized; _lidAngleSign = (((Quaternion.AngleAxis(90f, _lidAxisL) * ladderDirL).y > 0f) ? 1f : (-1f)); GameObject val13 = new GameObject("Lid"); val13.transform.SetParent(_lidPivot, false); val13.transform.localPosition = ladderDirL * (holeHalf + 0.1f); float num14 = holeHalf * 2f + 0.34f; ProcAssets.Part(val13.transform, (PrimitiveType)3, "LidPanel", Vector3.zero, Vector3.zero, new Vector3(num14, 0.09f, num14), mat2); Vector3 zero = Vector3.zero; ProcAssets.Part(val13.transform, (PrimitiveType)3, "Rib0", Vector3.up * 0.055f + normalized * (num14 * 0.28f), zero, RibSize(ladderDirL, num14), mat); ProcAssets.Part(val13.transform, (PrimitiveType)3, "Rib1", Vector3.up * 0.055f - normalized * (num14 * 0.28f), zero, RibSize(ladderDirL, num14), mat); ProcAssets.Part(val13.transform, (PrimitiveType)3, "LidHazard0", Vector3.up * 0.048f + ladderDirL * (num14 * 0.33f), Vector3.zero, HazardStripSize(ladderDirL, num14), mat3); ProcAssets.Part(val13.transform, (PrimitiveType)3, "LidHazard1", Vector3.up * 0.048f - ladderDirL * (num14 * 0.33f), Vector3.zero, HazardStripSize(ladderDirL, num14), mat3); GameObject val14 = new GameObject("Wheel"); val14.transform.SetParent(val13.transform, false); val14.transform.localPosition = Vector3.up * 0.13f; _wheel = val14.transform; ProcAssets.Part(_wheel, (PrimitiveType)2, "Hub", Vector3.zero, Vector3.zero, new Vector3(0.1f, 0.035f, 0.1f), val); for (int k = 0; k < 4; k++) { float num15 = (float)k * 90f; Vector3 val15 = Quaternion.Euler(0f, num15, 0f) * Vector3.forward; ProcAssets.Part(_wheel, (PrimitiveType)3, "Spoke", val15 * 0.11f, new Vector3(0f, num15, 0f), new Vector3(0.03f, 0.03f, 0.22f), val); } int num16 = 10; float num17 = 0.23f; for (int l = 0; l < num16; l++) { float num18 = (float)l * 360f / (float)num16; Vector3 val16 = Quaternion.Euler(0f, num18, 0f) * Vector3.forward; ProcAssets.Part(_wheel, (PrimitiveType)2, "Rim", val16 * num17, new Vector3(90f, num18 + 90f, 0f), new Vector3(0.055f, MathF.PI * num17 / (float)num16 * 1.25f, 0.055f), val2); } ProcAssets.Part(val13.transform, (PrimitiveType)3, "HandleBar", Vector3.down * 0.12f, Vector3.zero, HandleSize(normalized), val2); ProcAssets.Part(val13.transform, (PrimitiveType)3, "HandlePost0", Vector3.down * 0.075f + normalized * 0.16f, Vector3.zero, new Vector3(0.035f, 0.06f, 0.035f), val); ProcAssets.Part(val13.transform, (PrimitiveType)3, "HandlePost1", Vector3.down * 0.075f - normalized * 0.16f, Vector3.zero, new Vector3(0.035f, 0.06f, 0.035f), val); ProcAssets.SolidBox(val13.transform, "LidPhys", Vector3.zero, new Vector3(num14, 0.09f, num14)); GameObject val17 = ProcAssets.Part(transform, (PrimitiveType)0, "IndicatorOut", holeCenterL + hingeDirL * (holeHalf + num / 2f) + normalized * (holeHalf * 0.7f) + Vector3.up * (num2 + 0.045f), Vector3.zero, Vector3.one * 0.085f, _matGlowRed); GameObject val18 = null; if (!_fallbackNoHole) { val18 = ProcAssets.Part(transform, (PrimitiveType)0, "IndicatorIn", holeCenterL + normalized * (holeHalf + 0.3f) + Vector3.down * 1.32f, Vector3.zero, Vector3.one * 0.1f, _matGlowRed); ProcAssets.Part(transform, (PrimitiveType)3, "IndicatorInBase", holeCenterL + normalized * (holeHalf + 0.3f) + Vector3.down * 1.26f, Vector3.zero, new Vector3(0.14f, 0.05f, 0.14f), val); } _indicators = (MeshRenderer[])(object)((!((Object)(object)val18 != (Object)null)) ? new MeshRenderer[1] { val17.GetComponent<MeshRenderer>() } : new MeshRenderer[2] { val17.GetComponent<MeshRenderer>(), val18.GetComponent<MeshRenderer>() }); try { Light val19 = null; Transform val20 = _elevator.Find("ShipElectricLights"); if ((Object)(object)val20 != (Object)null) { Light[] componentsInChildren = ((Component)val20).GetComponentsInChildren<Light>(true); foreach (Light val21 in componentsInChildren) { if ((int)val21.type == 2) { val19 = val21; break; } if ((Object)(object)val19 == (Object)null) { val19 = val21; } } } if ((Object)(object)val19 != (Object)null) { GameObject val22 = Object.Instantiate<GameObject>(((Component)val19).gameObject, transform); ((Object)val22).name = "HatchShaftLight"; val22.transform.localPosition = holeCenterL + Vector3.down * 0.45f; _shaftLight = val22.GetComponent<Light>(); _shaftLight.type = (LightType)2; _shaftLight.color = new Color(1f, 0.93f, 0.8f); _shaftLight.range = 6f; Light shaftLight = _shaftLight; shaftLight.intensity *= 0.4f; _shaftLight.shadows = (LightShadows)0; ((Behaviour)_shaftLight).enabled = false; } } catch (Exception ex) { Verbose("Shaft light clone failed: " + ex.Message); } ((Component)_audio).transform.localPosition = holeCenterL; _hiss = ProcAssets.Hiss(); _clank = ProcAssets.Clank(); _ratchet = ProcAssets.Ratchet(); } private static Vector3 SideBoxSize(Vector3 side, float thickness, float height, float length) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!(Mathf.Abs(side.x) > 0.5f)) { return new Vector3(length, height, thickness); } return new Vector3(thickness, height, length); } private static Vector3 RibSize(Vector3 d, float panel) { //IL_0000: 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_0023: Unknown result type (might be due to invalid IL or missing references) if (!(Mathf.Abs(d.x) > 0.5f)) { return new Vector3(0.06f, 0.04f, panel * 0.92f); } return new Vector3(panel * 0.92f, 0.04f, 0.06f); } private static Vector3 HazardStripSize(Vector3 d, float panel) { //IL_0000: 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_0023: Unknown result type (might be due to invalid IL or missing references) if (!(Mathf.Abs(d.x) > 0.5f)) { return new Vector3(panel * 0.8f, 0.008f, 0.16f); } return new Vector3(0.16f, 0.008f, panel * 0.8f); } private static Vector3 HandleSize(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!(Mathf.Abs(p.x) > 0.5f)) { return new Vector3(0.035f, 0.035f, 0.38f); } return new Vector3(0.38f, 0.035f, 0.035f); } private void ConfigureTriggers() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: 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_0200: 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_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: 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_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_033f: 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_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) Sprite hoverIcon = null; Sprite disabledHoverIcon = null; InteractTrigger[] array = Resources.FindObjectsOfTypeAll<InteractTrigger>(); foreach (InteractTrigger val in array) { if ((Object)(object)val.hoverIcon != (Object)null && !((Object)(object)val == (Object)(object)_lidTrigger) && !((Object)(object)val == (Object)(object)_ladderTrigger)) { hoverIcon = val.hoverIcon; disabledHoverIcon = (((Object)(object)val.disabledHoverIcon != (Object)null) ? val.disabledHoverIcon : val.hoverIcon); break; } } _lidTrigger.hoverIcon = hoverIcon; _lidTrigger.disabledHoverIcon = disabledHoverIcon; _ladderTrigger.hoverIcon = hoverIcon; _ladderTrigger.disabledHoverIcon = disabledHoverIcon; Transform val2 = _lidPivot.Find("Lid"); ((Component)_lidTrigger).transform.SetParent(val2, false); ((Component)_lidTrigger).transform.localPosition = Vector3.zero; BoxCollider component = ((Component)_lidTrigger).GetComponent<BoxCollider>(); component.size = new Vector3(_holeHalf * 2f + 0.34f, 0.3f, _holeHalf * 2f + 0.34f); ((Collider)component).enabled = true; _lidTrigger.hoverTip = "Open hatch : [LMB]"; ((UnityEvent<PlayerControllerB>)(object)_lidTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)OnLidInteract); Vector3 holeCenterL = _holeCenterL; Vector3 ladderDirL = _ladderDirL; Vector3 val3 = holeCenterL + ladderDirL * (_holeHalf - 0.48f); ((Component)_ladderTrigger).transform.localPosition = new Vector3(val3.x, (_floorYL + _roofYL + 1f) / 2f, val3.z); BoxCollider component2 = ((Component)_ladderTrigger).GetComponent<BoxCollider>(); component2.size = new Vector3(0.95f, _roofYL + 1.05f - _floorYL, 0.95f); ((Collider)component2).enabled = true; Quaternion val4 = Quaternion.LookRotation(ladderDirL, Vector3.up); _ladderTrigger.ladderHorizontalPosition.position = ((Component)this).transform.TransformPoint(new Vector3(val3.x, _floorYL + 1f, val3.z)); _ladderTrigger.bottomOfLadderPosition.position = ((Component)this).transform.TransformPoint(new Vector3(val3.x, _floorYL + 0.02f, val3.z) - ladderDirL * 0.35f); _ladderTrigger.bottomOfLadderPosition.rotation = ((Component)this).transform.rotation * val4; _ladderTrigger.topOfLadderPosition.position = ((Component)this).transform.TransformPoint(new Vector3(holeCenterL.x, _roofYL + 0.03f, holeCenterL.z) + ladderDirL * (_holeHalf + 0.95f)); _ladderTrigger.topOfLadderPosition.rotation = ((Component)this).transform.rotation * val4; _ladderTrigger.ladderPlayerPositionNode.position = ((Component)this).transform.TransformPoint(new Vector3(val3.x, _floorYL + 1f, val3.z)); _ladderTrigger.ladderPlayerPositionNode.rotation = ((Component)this).transform.rotation * val4; if (_fallbackNoHole) { _ladderTrigger.isLadder = false; _ladderTrigger.specialCharacterAnimation = false; _ladderTrigger.hoverTip = "Climb through : [LMB]"; ((UnityEvent<PlayerControllerB>)(object)_ladderTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)OnFallbackClimb); } ((UnityEvent<bool>)(object)_anim.onTriggerBool).AddListener((UnityAction<bool>)OnHatchToggled); ApplyState(_anim.boolValue, instant: true); } private void OnLidInteract(PlayerControllerB player) { if (!((Object)(object)player == (Object)null)) { _anim.TriggerAnimation(player); } } private void OnFallbackClimb(PlayerControllerB player) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_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_005a: 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_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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)player == (Object)null) && _anim.boolValue) { Vector3 val = ((LocalY(((Component)player).transform.position) < _roofYL - 0.5f) ? (new Vector3(_holeCenterL.x, _roofYL + 0.1f, _holeCenterL.z) + _ladderDirL * (_holeHalf + 0.9f)) : (new Vector3(_holeCenterL.x, _floorYL + 0.05f, _holeCenterL.z) + _ladderDirL * 0.2f)); player.TeleportPlayer(((Component)this).transform.TransformPoint(val), false, 0f, false, true); _audio.PlayOneShot(_clank, 0.6f); } } private void OnHatchToggled(bool open) { ApplyState(open, instant: false); } private void ApplyState(bool open, bool instant) { _lastOpen = open; _playedHissThisOpen = !open; _playedClankThisClose = open; if (instant) { _wheelT = (open ? 1f : 0f); _lidT = (open ? 1f : 0f); UpdateLidTransforms(); } _lidTrigger.hoverTip = (open ? "Close hatch : [LMB]" : "Open hatch : [LMB]"); if (!_fallbackNoHole) { _ladderTrigger.interactable = open; _ladderTrigger.disabledHoverTip = "Hatch is locked"; } else { _ladderTrigger.interactable = open; _ladderTrigger.disabledHoverTip = "Hatch is locked"; } MeshRenderer[] indicators = _indicators; foreach (MeshRenderer val in indicators) { if ((Object)(object)val != (Object)null) { ((Renderer)val).sharedMaterial = (open ? _matGlowGreen : _matGlowRed); } } if ((Object)(object)_shaftLight != (Object)null) { ((Behaviour)_shaftLight).enabled = open; } if (!instant && open && (Object)(object)_ratchet != (Object)null) { _audio.PlayOneShot(_ratchet, 0.9f); } } private void Update() { if (!_built) { return; } if (_anim.boolValue != _lastOpen) { ApplyState(_anim.boolValue, instant: false); } if (_lastOpen) { if (_wheelT < 1f) { _wheelT = Mathf.Min(1f, _wheelT + Time.deltaTime / 0.55f); if (_wheelT >= 1f && !_playedHissThisOpen && (Object)(object)_hiss != (Object)null) { _audio.PlayOneShot(_hiss, 1f); _playedHissThisOpen = true; } } else if (_lidT < 1f) { _lidT = Mathf.Min(1f, _lidT + Time.deltaTime / 0.9f); } } else if (_lidT > 0f) { _lidT = Mathf.Max(0f, _lidT - Time.deltaTime / 0.7f); if (_lidT <= 0f && !_playedClankThisClose && (Object)(object)_clank != (Object)null) { _audio.PlayOneShot(_clank, 1f); _playedClankThisClose = true; } } else if (_wheelT > 0f) { _wheelT = Mathf.Max(0f, _wheelT - Time.deltaTime / 0.55f); } UpdateLidTransforms(); } private void UpdateLidTransforms() { //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_00a8: 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) if (!((Object)(object)_lidPivot == (Object)null)) { float num = _lidT * _lidT * (3f - 2f * _lidT); float num2 = Mathf.Sin(Mathf.Clamp01(_lidT) * MathF.PI) * 0.045f * (_lastOpen ? 1f : 0.3f); float num3 = (num + num2) * 115f * _lidAngleSign; _lidPivot.localRotation = Quaternion.AngleAxis(num3, _lidAxisL); if ((Object)(object)_wheel != (Object)null) { _wheel.localRotation = Quaternion.AngleAxis(_wheelT * 540f, Vector3.up); } } } private void OnDestroy() { RestoreCuts(); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("blujay.ShipHatch", "ShipHatch", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "blujay.ShipHatch"; public const string Name = "ShipHatch"; public const string Version = "1.0.0"; internal static ManualLogSource Log; internal static ConfigEntry<int> CfgPrice; internal static ConfigEntry<bool> CfgStartUnlocked; internal static ConfigEntry<float> CfgOffsetX; internal static ConfigEntry<float> CfgOffsetZ; internal static ConfigEntry<float> CfgHoleSize; internal static ConfigEntry<bool> CfgVerbose; internal static GameObject HatchPrefab; private void Awake() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; CfgPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Store", "Price", 1500, new ConfigDescription("Credits cost of the Roof Hatch ship upgrade.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100000), Array.Empty<object>())); CfgStartUnlocked = ((BaseUnityPlugin)this).Config.Bind<bool>("Store", "StartUnlocked", false, "If true, the Roof Hatch comes free with the ship (no purchase needed). All players should use the same value."); CfgOffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("Placement", "OffsetX", 0f, new ConfigDescription("Extra X offset (ship-local meters) applied to the automatically chosen hatch position. All players should use the same value.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-6f, 6f), Array.Empty<object>())); CfgOffsetZ = ((BaseUnityPlugin)this).Config.Bind<float>("Placement", "OffsetZ", 0f, new ConfigDescription("Extra Z offset (ship-local meters) applied to the automatically chosen hatch position. All players should use the same value.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-6f, 6f), Array.Empty<object>())); CfgHoleSize = ((BaseUnityPlugin)this).Config.Bind<float>("Placement", "HatchSize", 1.5f, new ConfigDescription("Width of the hatch opening in meters. All players should use the same value.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.2f, 2.2f), Array.Empty<object>())); CfgVerbose = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "VerboseLogging", false, "Log detailed placement/build info."); BuildPrefab(); RegisterUnlockable(); new Harmony("blujay.ShipHatch").PatchAll(typeof(Patches)); Log.LogInfo((object)string.Format("{0} {1} loaded. Roof Hatch is in the store for ${2}.", "ShipHatch", "1.0.0", CfgPrice.Value)); } private static void BuildPrefab() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown HatchPrefab = NetworkPrefabs.CreateNetworkPrefab("ShipRoofHatch"); AutoParentToShip obj = HatchPrefab.AddComponent<AutoParentToShip>(); obj.overrideOffset = true; obj.positionOffset = Vector3.zero; obj.rotationOffset = Vector3.zero; GameObject val = new GameObject("HatchAudio"); val.transform.SetParent(HatchPrefab.transform, false); AudioSource val2 = val.AddComponent<AudioSource>(); val2.playOnAwake = false; val2.spatialBlend = 1f; val2.minDistance = 2f; val2.maxDistance = 24f; val2.rolloffMode = (AudioRolloffMode)1; AnimatedObjectTrigger obj2 = HatchPrefab.AddComponent<AnimatedObjectTrigger>(); obj2.isBool = true; obj2.animationString = "on"; obj2.setInitialState = false; obj2.doorType = 0; obj2.makeAudibleNoise = true; obj2.noiseLoudness = 0.65f; obj2.thisAudioSource = val2; obj2.boolTrueAudios = (AudioClip[])(object)new AudioClip[0]; obj2.boolFalseAudios = (AudioClip[])(object)new AudioClip[0]; obj2.secondaryAudios = (AudioClip[])(object)new AudioClip[0]; obj2.onTriggerBool = new BooleanEvent(); GameObject val3 = new GameObject("LidTrigger"); val3.transform.SetParent(HatchPrefab.transform, false); BoxCollider obj3 = val3.AddComponent<BoxCollider>(); ((Collider)obj3).isTrigger = true; ((Collider)obj3).enabled = false; MakeInteractTrigger(val3, "Open hatch : [LMB]"); val3.AddComponent<HatchLidMarker>(); GameObject val4 = new GameObject("LadderTrigger"); val4.transform.SetParent(HatchPrefab.transform, false); BoxCollider obj4 = val4.AddComponent<BoxCollider>(); ((Collider)obj4).isTrigger = true; ((Collider)obj4).enabled = false; InteractTrigger obj5 = MakeInteractTrigger(val4, "Climb : [LMB]"); obj5.isLadder = true; obj5.specialCharacterAnimation = true; obj5.animationWaitTime = 0.45f; obj5.useRaycastToGetTopPosition = false; obj5.topOfLadderPosition = NewNode(val4.transform, "TopOfLadder"); obj5.bottomOfLadderPosition = NewNode(val4.transform, "BottomOfLadder"); obj5.ladderHorizontalPosition = NewNode(val4.transform, "LadderHorizontal"); obj5.ladderPlayerPositionNode = NewNode(val4.transform, "LadderPlayerNode"); val4.AddComponent<HatchLadderMarker>(); HatchPrefab.AddComponent<HatchController>(); } private static Transform NewNode(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) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); return val.transform; } internal static InteractTrigger MakeInteractTrigger(GameObject go, string tip) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown go.tag = "InteractTrigger"; go.layer = 9; InteractTrigger obj = go.AddComponent<InteractTrigger>(); obj.hoverTip = tip; obj.disabledHoverTip = ""; obj.holdTip = ""; obj.interactable = true; obj.oneHandedItemAllowed = true; obj.twoHandedItemAllowed = true; obj.holdInteraction = false; obj.interactCooldown = true; obj.cooldownTime = 0.5f; obj.onInteract = new InteractEvent(); obj.onInteractEarly = new InteractEvent(); obj.onInteractEarlyOtherClients = new InteractEvent(); obj.onStopInteract = new InteractEvent(); obj.onCancelAnimation = new InteractEvent(); obj.holdingInteractEvent = new InteractEventFloat(); return obj; } private static void RegisterUnlockable() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_003e: 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_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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown UnlockableItem val = new UnlockableItem { unlockableName = "Roof Hatch", prefabObject = HatchPrefab, unlockableType = 1, IsPlaceable = false, alwaysInStock = true, spawnPrefab = true, canBeStored = false, maxNumber = 1, hasBeenMoved = false, placedPosition = Vector3.zero, placedRotation = Vector3.zero, alreadyUnlocked = CfgStartUnlocked.Value }; TerminalNode val2 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val2).name = "RoofHatchInfoNode"; val2.displayText = "ROOF HATCH\nCompany-certified overhead egress module.\n\nCuts a reinforced access shaft through the hull above the upper deck, complete with pressure-rated trapdoor, hand-crank lock wheel and service ladder. Enjoy your new sky office. The Company is not liable for anything that follows you back inside.\n\nRequires the 2 Story Ship mod to deploy.\n\n"; val2.clearPreviousText = true; val2.maxCharactersToType = 25; Unlockables.RegisterUnlockable(val, (StoreType)1, (TerminalNode)null, (TerminalNode)null, val2, CfgPrice.Value); } } public class HatchLidMarker : MonoBehaviour { } public class HatchLadderMarker : MonoBehaviour { } internal static class Patches { [HarmonyPatch(typeof(InteractTrigger), "Interact")] [HarmonyPrefix] private static void InteractPrefix(InteractTrigger __instance, Transform playerTransform, ref PlayerControllerB __state) { __state = null; if (!((Object)(object)__instance == (Object)null) && !((Object)(object)((Component)__instance).GetComponent<HatchLadderMarker>() == (Object)null)) { PlayerControllerB val = (((Object)(object)playerTransform != (Object)null) ? ((Component)playerTransform).GetComponent<PlayerControllerB>() : null); if ((Object)(object)val != (Object)null && val.isInHangarShipRoom) { val.isInHangarShipRoom = false; __state = val; } } } [HarmonyPatch(typeof(InteractTrigger), "Interact")] [HarmonyPostfix] private static void InteractPostfix(PlayerControllerB __state) { if ((Object)(object)__state != (Object)null) { __state.isInHangarShipRoom = true; } } } internal static class ProcAssets { private static Shader _lit; private const int Rate = 44100; private static Random _rng = new Random(1337); internal static Shader Lit { get { if ((Object)(object)_lit == (Object)null) { _lit = Shader.Find("HDRP/Lit"); } return _lit; } } internal static Material Metal(Color baseColor, float metallic, float smoothness) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown Material val = new Material(Lit) { name = "ShipHatchMetal" }; val.SetColor("_BaseColor", baseColor); val.SetFloat("_Metallic", metallic); val.SetFloat("_Smoothness", smoothness); return val; } internal static Material Emissive(Color baseColor, Color emissive, float nits) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) Material obj = Metal(baseColor, 0.1f, 0.5f); ((Object)obj).name = "ShipHatchEmissive"; obj.SetColor("_EmissiveColor", emissive * nits); obj.SetFloat("_EmissiveExposureWeight", 0.55f); return obj; } internal static Material Hazard() { //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_001d: Expected O, but got Unknown //IL_00af: 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) /