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 DockFortress v1.0.0
DockFortress.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Net; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Threading; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Microsoft.CodeAnalysis; using MyMods.Web; using Newtonsoft.Json; using UnityEngine; using UnityEngine.Rendering; [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("DockFortress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5176e54b018e5e7315c3b1f7a8be00a710c39aae")] [assembly: AssemblyProduct("DockFortress")] [assembly: AssemblyTitle("DockFortress")] [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 MyMods.Web { public static class WebNav { public sealed class Link { public readonly string Id; public readonly string Label; public readonly int Port; public string Url => "http://127.0.0.1:" + Port + "/"; public Link(string id, string label, int port) { Id = id; Label = label; Port = port; } } public static readonly Link[] Links = new Link[18] { new Link("monsters", "Monsters", 8777), new Link("searoute", "SeaRoute", 8778), new Link("longboat", "Harpoon Longboat", 8779), new Link("tradewind", "TradeWind", 8780), new Link("safeharbor", "Safe Harbor", 8781), new Link("hub", "DFG Hub", 8782), new Link("vault", "Viking Vault", 8783), new Link("qolvault", "QoL Vault Buttons", 8784), new Link("qolinventory", "QoL Inventory Buttons", 8785), new Link("cacophony", "Cacophony", 8787), new Link("ominous", "Ominous", 8788), new Link("pebble", "Pebble", 8789), new Link("trolls", "Trolls", 8790), new Link("transporter", "Transporter", 8791), new Link("skytram", "Sky-Tram", 8792), new Link("dockfortress", "Dock Fortress", 8793), new Link("odinseye", "Odin's Eye", 8794), new Link("skyherd", "Skyherd", 8795) }; public const string Style = "nav.top{position:sticky;top:0;z-index:20;font-family:Segoe UI,Arial,sans-serif;background:#0d1219;border-bottom:1px solid #2b3b4c;padding:6px 14px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}\nnav.top .brand{color:#7f8fa0;font-size:11px;text-transform:uppercase;letter-spacing:.6px;margin-right:8px}\nnav.top a{color:#9fc3dd;text-decoration:none;font-size:13px;padding:4px 9px;border-radius:5px}\nnav.top a:hover{background:#1a2530}\nnav.top a.here{background:#3a2b4c;border:1px solid #55406b;color:#efe0ff}\n"; public static string Html(string currentId) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<nav class='top'><span class='brand'>MyMods</span>"); Link[] links = Links; foreach (Link link in links) { stringBuilder.Append("<a class='"); if (link.Id == currentId) { stringBuilder.Append("here"); } stringBuilder.Append("' href='").Append(link.Url).Append("'>") .Append(link.Label) .Append("</a>"); } stringBuilder.Append("</nav>"); return stringBuilder.ToString(); } public static Link Find(string id) { Link[] links = Links; foreach (Link link in links) { if (link.Id == id) { return link; } } return null; } } } namespace DockFortress { public class DockCrane : MonoBehaviour, Hoverable, Interactable { public enum CraneState { Idle, SlewingToShip, HarpooningFromBerth, ReelingFromBerth, SlewingToDryDock, LoweringToDryDock, DetachingAtDryDock, SlewingToTargetDock, HarpooningFromDryDock, ReelingFromDryDock, SlewingToBerth, LoweringToBerth, DetachingAtBerth, ReturningToCenter } private DockGatePiece m_gate; private DryDockArea m_dryDock; private int m_craneIndex = 1; private float m_baseAngle; private CraneState m_state; private Ship m_activeShip; private DryDockArea m_activeDock; private GameObject m_slewPivot; private GameObject m_armPitchPivot; private GameObject m_hookTipMarker; private Transform m_partTurntable; private Transform m_partCog; private Transform m_partCounter; private Transform m_partArmMain; private Transform m_partArmOuter; private Transform m_partStaticLine; private Transform m_partStaticHook; private LineRenderer m_mainCable; private LineRenderer[] m_slingCables; private bool m_slingsActive; private float m_harpoonProgress; private float m_stateTimer; private float m_progress; private Vector3 m_liftStartPos; private Quaternion m_liftStartRot; private Vector3 m_liftTargetPos; private Quaternion m_liftTargetRot; private const float CanalYaw = 0f; private const float DockYaw = 180f; private float m_currentSlewYaw; private float m_aimShipYaw; private float m_targetSlewYaw = 180f; public const float RestPitch = 0f; public const float LoweredWaterPitch = 22f; public const float ElevatedLiftPitch = -10f; public const float LoweredDryDockPitch = 18f; private float m_currentPitchAngle; private Material m_cableMat; public CraneState State => m_state; public Ship ActiveShip => m_activeShip; public DryDockArea DryDock => m_dryDock; public int CraneIndex => m_craneIndex; public bool IsBusy => m_state != CraneState.Idle; public static DockCrane Setup(GameObject craneObj, DockGatePiece gate, int craneIndex = 1, float baseAngle = 0f) { if ((Object)(object)craneObj == (Object)null) { return null; } DockCrane dockCrane = craneObj.GetComponent<DockCrane>(); if ((Object)(object)dockCrane == (Object)null) { dockCrane = craneObj.AddComponent<DockCrane>(); } dockCrane.m_gate = gate; dockCrane.m_craneIndex = craneIndex; dockCrane.m_baseAngle = baseAngle; dockCrane.Initialize(); return dockCrane; } public void SetDryDock(DryDockArea dryDock) { m_dryDock = dryDock; } public void SetStaticRiggingVisible(bool visible) { if ((Object)(object)m_partStaticLine != (Object)null) { ((Component)m_partStaticLine).gameObject.SetActive(visible); Renderer component = ((Component)m_partStaticLine).GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { component.enabled = visible; } } if ((Object)(object)m_partStaticHook != (Object)null) { ((Component)m_partStaticHook).gameObject.SetActive(visible); Renderer component2 = ((Component)m_partStaticHook).GetComponent<Renderer>(); if ((Object)(object)component2 != (Object)null) { component2.enabled = visible; } } } private void Initialize() { MapModelParts(); SetupCables(); SetupFloodlight(); m_currentSlewYaw = 0f; m_targetSlewYaw = 180f; m_aimShipYaw = 0f; ApplySlewYaw(m_currentSlewYaw); ApplyPitch(0f); SetStaticRiggingVisible(visible: true); } private void MapModelParts() { //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0188: 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_07a2: Unknown result type (might be due to invalid IL or missing references) //IL_07ac: Expected O, but got Unknown //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0857: 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_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_0819: Unknown result type (might be due to invalid IL or missing references) //IL_081f: Unknown result type (might be due to invalid IL or missing references) //IL_082b: Unknown result type (might be due to invalid IL or missing references) //IL_0837: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: 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_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) m_partTurntable = FindChildRecursive(((Component)this).transform, "tripo_part_6") ?? FindChildRecursive(((Component)this).transform, "tripo_part_10"); m_partCog = FindChildRecursive(((Component)this).transform, "tripo_part_121"); m_partCounter = FindChildRecursive(((Component)this).transform, "tripo_part_4"); m_partArmMain = FindChildRecursive(((Component)this).transform, "tripo_part_3") ?? FindChildRecursive(((Component)this).transform, "tripo_part_5"); m_partArmOuter = FindChildRecursive(((Component)this).transform, "tripo_part_45") ?? FindChildRecursive(((Component)this).transform, "tripo_part_14"); m_partStaticLine = FindChildRecursive(((Component)this).transform, "tripo_part_15"); m_partStaticHook = FindChildRecursive(((Component)this).transform, "tripo_part_25"); Bounds bounds; if ((Object)(object)m_slewPivot == (Object)null) { m_slewPivot = new GameObject("CraneSlewPivot"); m_slewPivot.transform.SetParent(((Component)this).transform, false); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0.08f, 0.08f, 0f); if ((Object)(object)m_partTurntable != (Object)null) { MeshFilter component = ((Component)m_partTurntable).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null) { bounds = component.sharedMesh.bounds; val = ((Bounds)(ref bounds)).center; } else { val = m_partTurntable.localPosition; } } val.y = Mathf.Max(0.08f, val.y); m_slewPivot.transform.localPosition = val; Transform val2 = ((Component)this).transform.Find("ROOT"); Transform[] componentsInChildren = ((Component)(((Object)(object)val2 != (Object)null) ? val2 : ((Component)this).transform)).GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { if ((Object)(object)val3 == (Object)(object)((Component)this).transform || (Object)(object)val3 == (Object)(object)m_slewPivot.transform || (Object)(object)val3.parent == (Object)(object)m_slewPivot.transform || !((Object)val3).name.StartsWith("tripo_part_")) { continue; } MeshFilter component2 = ((Component)val3).GetComponent<MeshFilter>(); if ((Object)(object)component2 != (Object)null && (Object)(object)component2.sharedMesh != (Object)null) { Bounds bounds2 = component2.sharedMesh.bounds; if (((Object)val3).name == "tripo_part_6" || ((Object)val3).name == "tripo_part_10" || ((Object)val3).name == "tripo_part_15" || ((Object)val3).name == "tripo_part_25" || (((Bounds)(ref bounds2)).max.y >= 0.25f && Mathf.Abs(((Bounds)(ref bounds2)).center.z) <= 0.15f)) { val3.SetParent(m_slewPivot.transform, true); } } } } if ((Object)(object)m_armPitchPivot == (Object)null && (Object)(object)m_slewPivot != (Object)null) { m_armPitchPivot = new GameObject("CraneArmPitchPivot"); m_armPitchPivot.transform.SetParent(m_slewPivot.transform, false); Vector3 center = default(Vector3); ((Vector3)(ref center))..ctor(0.086f, 0.48f, -0.015f); if ((Object)(object)m_partCog != (Object)null) { MeshFilter component3 = ((Component)m_partCog).GetComponent<MeshFilter>(); if ((Object)(object)component3 != (Object)null && (Object)(object)component3.sharedMesh != (Object)null) { bounds = component3.sharedMesh.bounds; center = ((Bounds)(ref bounds)).center; } } Vector3 position = ((Component)this).transform.TransformPoint(center); m_armPitchPivot.transform.position = position; Transform[] componentsInChildren = m_slewPivot.GetComponentsInChildren<Transform>(true); foreach (Transform val4 in componentsInChildren) { if ((Object)(object)val4 == (Object)(object)m_slewPivot.transform || (Object)(object)val4 == (Object)(object)m_armPitchPivot.transform || (Object)(object)val4.parent == (Object)(object)m_armPitchPivot.transform || !((Object)val4).name.StartsWith("tripo_part_")) { continue; } MeshFilter component4 = ((Component)val4).GetComponent<MeshFilter>(); if ((Object)(object)component4 != (Object)null && (Object)(object)component4.sharedMesh != (Object)null) { Bounds bounds3 = component4.sharedMesh.bounds; if (((((Bounds)(ref bounds3)).max.y >= 0.25f && (((Bounds)(ref bounds3)).min.x < -0.02f || ((Bounds)(ref bounds3)).max.x > 0.2f)) || ((Object)val4).name == "tripo_part_3" || ((Object)val4).name == "tripo_part_4" || ((Object)val4).name == "tripo_part_5" || ((Object)val4).name == "tripo_part_7" || ((Object)val4).name == "tripo_part_12" || ((Object)val4).name == "tripo_part_13" || ((Object)val4).name == "tripo_part_14" || ((Object)val4).name == "tripo_part_15" || ((Object)val4).name == "tripo_part_23" || ((Object)val4).name == "tripo_part_25" || ((Object)val4).name == "tripo_part_26" || ((Object)val4).name == "tripo_part_30" || ((Object)val4).name == "tripo_part_33" || ((Object)val4).name == "tripo_part_35" || ((Object)val4).name == "tripo_part_45" || ((Object)val4).name == "tripo_part_48" || ((Object)val4).name == "tripo_part_53" || ((Object)val4).name == "tripo_part_60" || ((Object)val4).name == "tripo_part_79" || ((Object)val4).name == "tripo_part_82" || ((Object)val4).name == "tripo_part_85" || ((Object)val4).name == "tripo_part_90" || ((Object)val4).name == "tripo_part_101" || ((Object)val4).name == "tripo_part_105" || ((Object)val4).name == "tripo_part_121") && ((Object)val4).name != "tripo_part_6" && ((Object)val4).name != "tripo_part_10" && ((Object)val4).name != "tripo_part_16" && ((Object)val4).name != "tripo_part_17" && ((Object)val4).name != "tripo_part_32" && ((Object)val4).name != "tripo_part_36") { val4.SetParent(m_armPitchPivot.transform, true); } } } } if ((Object)(object)m_hookTipMarker == (Object)null) { m_hookTipMarker = new GameObject("CraneHookTipMarker"); m_hookTipMarker.transform.SetParent(((Component)this).transform, false); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(-0.489f, 0.655f, -0.023f); if ((Object)(object)m_partArmOuter != (Object)null) { MeshFilter component5 = ((Component)m_partArmOuter).GetComponent<MeshFilter>(); if ((Object)(object)component5 != (Object)null && (Object)(object)component5.sharedMesh != (Object)null) { Bounds bounds4 = component5.sharedMesh.bounds; ((Vector3)(ref val5))..ctor(((Bounds)(ref bounds4)).min.x, ((Bounds)(ref bounds4)).max.y, ((Bounds)(ref bounds4)).center.z); } } m_hookTipMarker.transform.position = ((Component)this).transform.TransformPoint(val5); if ((Object)(object)m_armPitchPivot != (Object)null) { m_hookTipMarker.transform.SetParent(m_armPitchPivot.transform, true); } } Logger.LogInfo((object)$"Dock Fortress: Crane #{m_craneIndex} parts mapped with arm pitch pivot and tip marker."); } private Transform FindChildRecursive(Transform parent, string childName) { if (((Object)parent).name == childName) { return parent; } for (int i = 0; i < parent.childCount; i++) { Transform val = FindChildRecursive(parent.GetChild(i), childName); if ((Object)(object)val != (Object)null) { return val; } } return null; } private void SetupFloodlight() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) Transform val = (((Object)(object)m_slewPivot != (Object)null) ? m_slewPivot.transform.Find("CraneFloodlight") : null) ?? ((Component)this).transform.Find("CraneFloodlight"); Light val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<Light>() : null); if ((Object)(object)val2 == (Object)null) { GameObject val3 = new GameObject("CraneFloodlight"); val3.transform.SetParent(((Object)(object)m_slewPivot != (Object)null) ? m_slewPivot.transform : ((Component)this).transform, false); val3.transform.localPosition = new Vector3(-0.35f, 0.48f, 0f); val2 = val3.AddComponent<Light>(); } val2.type = (LightType)2; float num = ((((Component)this).transform.lossyScale.x > 0.01f) ? ((Component)this).transform.lossyScale.x : DockFortressPlugin.CraneScale.Value); if (num < 0.01f) { num = 55f; } val2.range = 26f / num; val2.intensity = 1f; val2.color = new Color(1f, 0.9f, 0.72f); val2.shadows = (LightShadows)0; } private void SetupCables() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) Shader val = DockFortressGlb.FindValidShader(); m_cableMat = new Material(val) { name = "CraneCableMat" }; if (m_cableMat.HasProperty("_Color")) { m_cableMat.SetColor("_Color", new Color(0.2f, 0.22f, 0.25f, 0.95f)); } if (m_cableMat.HasProperty("_EmissionColor")) { m_cableMat.SetColor("_EmissionColor", new Color(0.35f, 0.38f, 0.42f)); m_cableMat.EnableKeyword("_EMISSION"); } if ((Object)(object)m_mainCable == (Object)null) { GameObject val2 = new GameObject("MainHoistCable"); val2.transform.SetParent(((Component)this).transform, false); m_mainCable = val2.AddComponent<LineRenderer>(); m_mainCable.useWorldSpace = true; m_mainCable.startWidth = 0.22f; m_mainCable.endWidth = 0.22f; m_mainCable.positionCount = 2; ((Renderer)m_mainCable).sharedMaterial = m_cableMat; ((Renderer)m_mainCable).enabled = false; } if (m_slingCables == null || m_slingCables.Length != 4) { m_slingCables = (LineRenderer[])(object)new LineRenderer[4]; string[] array = new string[4] { "SlingBowPort", "SlingBowStbd", "SlingSternPort", "SlingSternStbd" }; for (int i = 0; i < 4; i++) { GameObject val3 = new GameObject(array[i]); val3.transform.SetParent(((Component)this).transform, false); LineRenderer val4 = val3.AddComponent<LineRenderer>(); val4.useWorldSpace = true; val4.startWidth = 0.16f; val4.endWidth = 0.16f; val4.positionCount = 2; ((Renderer)val4).sharedMaterial = m_cableMat; ((Renderer)val4).enabled = false; m_slingCables[i] = val4; } } } public Vector3 GetHookTipWorldPosition() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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) if ((Object)(object)m_hookTipMarker != (Object)null) { return m_hookTipMarker.transform.position; } if ((Object)(object)m_partArmOuter != (Object)null) { MeshFilter component = ((Component)m_partArmOuter).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null) { Bounds bounds = component.sharedMesh.bounds; return m_partArmOuter.TransformPoint(new Vector3(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds)).center.z)); } return m_partArmOuter.TransformPoint(new Vector3(-0.489f, 0.655f, -0.023f)); } if ((Object)(object)m_slewPivot != (Object)null) { return m_slewPivot.transform.TransformPoint(new Vector3(-0.489f, 0.655f, -0.023f)); } return ((Component)this).transform.position + Vector3.up * 20f; } public void UpdateTransform(float x, float y, float z, float scale, float baseAngle) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) ((Component)this).transform.localPosition = new Vector3(x, y, z); ((Component)this).transform.localScale = Vector3.one * scale; m_baseAngle = baseAngle; if (!IsBusy) { ((Component)this).transform.localRotation = Quaternion.Euler(0f, baseAngle, 0f); } Transform val = (((Object)(object)m_slewPivot != (Object)null) ? m_slewPivot.transform.Find("CraneFloodlight") : null) ?? ((Component)this).transform.Find("CraneFloodlight"); if ((Object)(object)val != (Object)null) { Light component = ((Component)val).GetComponent<Light>(); if ((Object)(object)component != (Object)null && scale > 0.01f) { component.range = 26f / scale; } } } private float CalculateSlewYawToPosition(Vector3 worldPos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.InverseTransformDirection(worldPos - ((Component)this).transform.position); val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return 0f; } return Vector3.SignedAngle(Vector3.left, ((Vector3)(ref val)).normalized, Vector3.up); } private void ApplySlewYaw(float yawAngle) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) m_currentSlewYaw = yawAngle; if ((Object)(object)m_slewPivot != (Object)null) { m_slewPivot.transform.localRotation = Quaternion.Euler(0f, yawAngle, 0f); } } private void ApplyPitch(float pitchAngle) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) m_currentPitchAngle = pitchAngle; if ((Object)(object)m_armPitchPivot != (Object)null) { m_armPitchPivot.transform.localRotation = Quaternion.Euler(0f, 0f, pitchAngle); } } private void SpinDriveCog(float speedDegreesPerSec) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_partCog != (Object)null) { m_partCog.Rotate(Vector3.forward, speedDegreesPerSec * Time.deltaTime, (Space)1); } } public bool StartHoistToDryDock(Ship ship, DryDockArea targetDock = null) { //IL_0110: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ship == (Object)null || IsBusy) { return false; } if ((Object)(object)targetDock == (Object)null) { targetDock = m_dryDock; } if ((Object)(object)targetDock == (Object)null && (Object)(object)m_gate != (Object)null && m_gate.DryDocks.Count > 0) { foreach (DryDockArea dryDock in m_gate.DryDocks) { if ((Object)(object)dryDock != (Object)null && (Object)(object)dryDock.DryDockedShip == (Object)null) { targetDock = dryDock; break; } } } if ((Object)(object)targetDock == (Object)null || (Object)(object)targetDock.DryDockedShip != (Object)null) { if ((Object)(object)Player.m_localPlayer != (Object)null) { ((Character)Player.m_localPlayer).Message((MessageType)2, $"<color=yellow>Dry Dock #{m_craneIndex} ({targetDock?.DockName}) is occupied!</color>", 0, (Sprite)null, false); } return false; } m_activeShip = ship; m_activeDock = targetDock; LockShipKinematics(ship); m_aimShipYaw = CalculateSlewYawToPosition(((Component)ship).transform.position); m_targetSlewYaw = 180f; m_state = CraneState.SlewingToShip; m_stateTimer = 0f; m_progress = 0f; m_slingsActive = false; SetStaticRiggingVisible(visible: false); PlaySound("sfx_wheel_turn"); if ((Object)(object)Player.m_localPlayer != (Object)null) { ((Character)Player.m_localPlayer).Message((MessageType)2, $"<color=#00E5FF>Crane #{m_craneIndex} lowering arm and aligning directly with vessel...</color>", 0, (Sprite)null, false); } Logger.LogInfo((object)$"Dock Fortress: Crane #{m_craneIndex} aligning with ship for hoist into Dry Dock #{targetDock.DockIndex}."); return true; } public bool StartLaunchToWater(Ship ship) { if ((Object)(object)ship == (Object)null || IsBusy) { return false; } DryDockArea dryDockArea = m_dryDock; if ((Object)(object)dryDockArea == (Object)null && (Object)(object)m_gate != (Object)null) { foreach (DryDockArea dryDock in m_gate.DryDocks) { if ((Object)(object)dryDock != (Object)null && (Object)(object)dryDock.DryDockedShip == (Object)(object)ship) { dryDockArea = dryDock; break; } } } if ((Object)(object)dryDockArea != (Object)null) { return StartLaunchFromDryDock(dryDockArea); } return false; } public bool StartLaunchFromDryDock(DryDockArea sourceDock) { if ((Object)(object)sourceDock == (Object)null || (Object)(object)sourceDock.DryDockedShip == (Object)null || IsBusy) { return false; } m_activeShip = sourceDock.DryDockedShip; m_activeDock = sourceDock; LockShipKinematics(m_activeShip); m_targetSlewYaw = 180f; m_state = CraneState.SlewingToTargetDock; m_stateTimer = 0f; m_progress = 0f; m_slingsActive = false; SetStaticRiggingVisible(visible: false); PlaySound("sfx_wheel_turn"); if ((Object)(object)Player.m_localPlayer != (Object)null) { ((Character)Player.m_localPlayer).Message((MessageType)2, $"<color=#00E5FF>Crane #{m_craneIndex} lowering arm into Dry Dock #{sourceDock.DockIndex} to lift vessel...</color>", 0, (Sprite)null, false); } Logger.LogInfo((object)$"Dock Fortress: Crane #{m_craneIndex} launching vessel from Dry Dock #{sourceDock.DockIndex} started."); return true; } public void ToggleCraneAction() { if (IsBusy) { return; } if ((Object)(object)m_dryDock != (Object)null && (Object)(object)m_dryDock.DryDockedShip != (Object)null) { StartLaunchFromDryDock(m_dryDock); return; } Ship val = (((Object)(object)m_gate != (Object)null) ? m_gate.FindMooredShip() : null); if ((Object)(object)val != (Object)null && (Object)(object)m_dryDock != (Object)null && (Object)(object)m_dryDock.DryDockedShip == (Object)null) { StartHoistToDryDock(val, m_dryDock); } } private void Update() { if ((Object)(object)m_activeShip == (Object)null && IsBusy && m_state != CraneState.ReturningToCenter) { ResetCraneState(); return; } switch (m_state) { case CraneState.SlewingToShip: HandleSlewingToShip(); break; case CraneState.HarpooningFromBerth: HandleHarpooningFromBerth(); break; case CraneState.ReelingFromBerth: HandleReelingFromBerth(); break; case CraneState.SlewingToDryDock: HandleSlewingToDryDock(); break; case CraneState.LoweringToDryDock: HandleLoweringToDryDock(); break; case CraneState.DetachingAtDryDock: HandleDetachingAtDryDock(); break; case CraneState.SlewingToTargetDock: HandleSlewingToTargetDock(); break; case CraneState.HarpooningFromDryDock: HandleHarpooningFromDryDock(); break; case CraneState.ReelingFromDryDock: HandleReelingFromDryDock(); break; case CraneState.SlewingToBerth: HandleSlewingToBerth(); break; case CraneState.LoweringToBerth: HandleLoweringToBerth(); break; case CraneState.DetachingAtBerth: HandleDetachingAtBerth(); break; case CraneState.ReturningToCenter: HandleReturningToCenter(); break; } UpdateCableVisuals(); } private void HandleSlewingToShip() { m_progress += Time.deltaTime * 0.4f; float num = Mathf.SmoothStep(0f, 1f, m_progress); m_currentSlewYaw = Mathf.LerpAngle(0f, m_aimShipYaw, num); ApplySlewYaw(m_currentSlewYaw); ApplyPitch(Mathf.Lerp(0f, 22f, num)); SpinDriveCog(60f); if (m_progress >= 1f || Mathf.Abs(Mathf.DeltaAngle(m_currentSlewYaw, m_aimShipYaw)) < 0.5f) { m_currentSlewYaw = m_aimShipYaw; ApplySlewYaw(m_currentSlewYaw); ApplyPitch(22f); m_state = CraneState.HarpooningFromBerth; m_stateTimer = 0f; m_harpoonProgress = 0f; m_slingsActive = true; PlaySound("sfx_spear_throw"); PlaySound("sfx_chain_equip"); if ((Object)(object)Player.m_localPlayer != (Object)null) { ((Character)Player.m_localPlayer).Message((MessageType)2, "<color=#00E5FF>Crane boom lowered over vessel! Firing lift slings from hook...</color>", 0, (Sprite)null, false); } } } private void HandleHarpooningFromBerth() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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) m_stateTimer += Time.deltaTime; m_harpoonProgress = Mathf.Clamp01(m_stateTimer / 1.5f); m_currentSlewYaw = m_aimShipYaw; ApplySlewYaw(m_currentSlewYaw); ApplyPitch(22f); if (m_stateTimer >= 1.5f) { m_state = CraneState.ReelingFromBerth; m_progress = 0f; m_liftStartPos = ((Component)m_activeShip).transform.position; m_liftStartRot = ((Component)m_activeShip).transform.rotation; m_liftTargetPos = m_liftStartPos + Vector3.up * DockFortressPlugin.CraneLiftHeight.Value; PlaySound("sfx_wheel_turn"); PlayWaterSplash(m_liftStartPos); } } private void HandleReelingFromBerth() { //IL_005b: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) m_progress += Time.deltaTime * 0.22f; float num = Mathf.SmoothStep(0f, 1f, m_progress); SpinDriveCog(240f); ApplyPitch(Mathf.Lerp(22f, -10f, num)); ((Component)m_activeShip).transform.position = Vector3.Lerp(m_liftStartPos, m_liftTargetPos, num); if (m_progress >= 1f) { m_state = CraneState.SlewingToDryDock; m_progress = 0f; m_liftStartPos = ((Component)m_activeShip).transform.position; m_liftStartRot = ((Component)m_activeShip).transform.rotation; Vector3 val = (((Object)(object)m_activeDock != (Object)null) ? m_activeDock.GetCradleWorldPosition() : (((Component)this).transform.position + ((Component)this).transform.right * 20f)); Quaternion liftTargetRot = (((Object)(object)m_activeDock != (Object)null) ? m_activeDock.GetCradleRotation() : ((Component)m_activeShip).transform.rotation); m_liftTargetPos = val + Vector3.up * DockFortressPlugin.CraneLiftHeight.Value; m_liftTargetRot = liftTargetRot; PlaySound("sfx_gate_open"); } } private void HandleSlewingToDryDock() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) m_progress += Time.deltaTime * 0.14f; float num = Mathf.SmoothStep(0f, 1f, m_progress); ApplyPitch(-10f); m_currentSlewYaw = Mathf.LerpAngle(m_aimShipYaw, 180f, num); ApplySlewYaw(m_currentSlewYaw); Vector3 val = (m_liftStartPos + m_liftTargetPos) * 0.5f + Vector3.up * 3f; Vector3 position = Vector3.Lerp(Vector3.Lerp(m_liftStartPos, val, num), Vector3.Lerp(val, m_liftTargetPos, num), num); ((Component)m_activeShip).transform.position = position; ((Component)m_activeShip).transform.rotation = Quaternion.Slerp(m_liftStartRot, m_liftTargetRot, num); if (m_progress >= 1f) { m_state = CraneState.LoweringToDryDock; m_progress = 0f; m_liftStartPos = ((Component)m_activeShip).transform.position; m_liftStartRot = ((Component)m_activeShip).transform.rotation; Vector3 liftTargetPos = (((Object)(object)m_activeDock != (Object)null) ? m_activeDock.GetCradleWorldPosition() : (((Component)this).transform.position + ((Component)this).transform.right * 20f)); m_liftTargetPos = liftTargetPos; PlaySound("sfx_wheel_turn"); } } private void HandleLoweringToDryDock() { //IL_005b: 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_0067: Unknown result type (might be due to invalid IL or missing references) m_progress += Time.deltaTime * 0.22f; float num = Mathf.SmoothStep(0f, 1f, m_progress); SpinDriveCog(-240f); ApplyPitch(Mathf.Lerp(-10f, 18f, num)); ((Component)m_activeShip).transform.position = Vector3.Lerp(m_liftStartPos, m_liftTargetPos, num); if (m_progress >= 1f) { m_state = CraneState.DetachingAtDryDock; m_stateTimer = 0f; PlaySound("sfx_stone_hit"); PlaySound("sfx_wood_hit"); if ((Object)(object)m_activeDock != (Object)null) { m_activeDock.SetDryDockedShip(m_activeShip); } ShipFortressMooring component = ((Component)m_activeShip).GetComponent<ShipFortressMooring>(); if ((Object)(object)component != (Object)null) { component.SetDryDocked(dryDocked: true); } if ((Object)(object)Player.m_localPlayer != (Object)null && (Object)(object)m_activeDock != (Object)null) { ((Character)Player.m_localPlayer).Message((MessageType)2, $"<color=#A3E635>Vessel securely cradled in Dry Dock #{m_activeDock.DockIndex} ({m_activeDock.DockName})! Automated hull restoration active.</color>", 0, (Sprite)null, false); } } } private void HandleDetachingAtDryDock() { m_stateTimer += Time.deltaTime; ApplyPitch(Mathf.Lerp(18f, 0f, Mathf.Clamp01(m_stateTimer / 1.5f))); if (m_stateTimer > 1.8f) { m_slingsActive = false; m_activeShip = null; m_state = CraneState.ReturningToCenter; m_progress = 0f; } } private void HandleSlewingToTargetDock() { m_progress += Time.deltaTime * 0.35f; float num = Mathf.SmoothStep(0f, 1f, m_progress); m_currentSlewYaw = Mathf.LerpAngle(m_currentSlewYaw, 180f, num); ApplySlewYaw(m_currentSlewYaw); ApplyPitch(Mathf.Lerp(0f, 18f, num)); SpinDriveCog(60f); if (m_progress >= 1f) { m_currentSlewYaw = 180f; ApplySlewYaw(180f); ApplyPitch(18f); m_state = CraneState.HarpooningFromDryDock; m_stateTimer = 0f; m_harpoonProgress = 0f; m_slingsActive = true; PlaySound("sfx_spear_throw"); PlaySound("sfx_chain_equip"); } } private void HandleHarpooningFromDryDock() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) m_stateTimer += Time.deltaTime; m_harpoonProgress = Mathf.Clamp01(m_stateTimer / 1.5f); m_currentSlewYaw = 180f; ApplySlewYaw(180f); ApplyPitch(18f); if (m_stateTimer >= 1.5f) { m_state = CraneState.ReelingFromDryDock; m_progress = 0f; m_liftStartPos = ((Component)m_activeShip).transform.position; m_liftStartRot = ((Component)m_activeShip).transform.rotation; m_liftTargetPos = m_liftStartPos + Vector3.up * DockFortressPlugin.CraneLiftHeight.Value; PlaySound("sfx_wheel_turn"); } } private void HandleReelingFromDryDock() { //IL_005b: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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) m_progress += Time.deltaTime * 0.22f; float num = Mathf.SmoothStep(0f, 1f, m_progress); SpinDriveCog(240f); ApplyPitch(Mathf.Lerp(18f, -10f, num)); ((Component)m_activeShip).transform.position = Vector3.Lerp(m_liftStartPos, m_liftTargetPos, num); if (m_progress >= 1f) { m_state = CraneState.SlewingToBerth; m_progress = 0f; m_liftStartPos = ((Component)m_activeShip).transform.position; m_liftStartRot = ((Component)m_activeShip).transform.rotation; Vector3 val = (((Object)(object)m_gate != (Object)null) ? m_gate.GetInnerBerthPosition() : (((Component)this).transform.position + ((Component)this).transform.forward * -20f)); val.z = ((Component)this).transform.position.z; Quaternion liftTargetRot = (((Object)(object)m_gate != (Object)null) ? m_gate.GetBerthRotation() : Quaternion.identity); m_liftTargetPos = val + Vector3.up * DockFortressPlugin.CraneLiftHeight.Value; m_liftTargetRot = liftTargetRot; PlaySound("sfx_gate_open"); } } private void HandleSlewingToBerth() { //IL_005c: 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_0067: 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_0080: 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_008a: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00cf: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_013d: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) m_progress += Time.deltaTime * 0.14f; float num = Mathf.SmoothStep(0f, 1f, m_progress); ApplyPitch(-10f); m_currentSlewYaw = Mathf.LerpAngle(180f, 0f, num); ApplySlewYaw(m_currentSlewYaw); Vector3 val = (m_liftStartPos + m_liftTargetPos) * 0.5f + Vector3.up * 3f; Vector3 position = Vector3.Lerp(Vector3.Lerp(m_liftStartPos, val, num), Vector3.Lerp(val, m_liftTargetPos, num), num); ((Component)m_activeShip).transform.position = position; ((Component)m_activeShip).transform.rotation = Quaternion.Slerp(m_liftStartRot, m_liftTargetRot, num); if (m_progress >= 1f) { m_state = CraneState.LoweringToBerth; m_progress = 0f; m_liftStartPos = ((Component)m_activeShip).transform.position; m_liftStartRot = ((Component)m_activeShip).transform.rotation; Vector3 liftTargetPos = (((Object)(object)m_gate != (Object)null) ? m_gate.GetInnerBerthPosition() : m_liftStartPos); liftTargetPos.z = ((Component)this).transform.position.z; m_liftTargetPos = liftTargetPos; PlaySound("sfx_wheel_turn"); } } private void HandleLoweringToBerth() { //IL_005b: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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) m_progress += Time.deltaTime * 0.22f; float num = Mathf.SmoothStep(0f, 1f, m_progress); SpinDriveCog(-240f); ApplyPitch(Mathf.Lerp(-10f, 22f, num)); ((Component)m_activeShip).transform.position = Vector3.Lerp(m_liftStartPos, m_liftTargetPos, num); if (!(m_progress >= 1f)) { return; } m_state = CraneState.DetachingAtBerth; m_stateTimer = 0f; PlayWaterSplash(((Component)m_activeShip).transform.position); if ((Object)(object)m_activeDock != (Object)null) { m_activeDock.ClearDryDockedShip(); } ShipFortressMooring component = ((Component)m_activeShip).GetComponent<ShipFortressMooring>(); if ((Object)(object)component != (Object)null) { component.SetDryDocked(dryDocked: false); if ((Object)(object)m_gate != (Object)null) { component.MooringLock(m_activeShip, m_gate, m_liftTargetPos, m_gate.GetBerthRotation()); } } if ((Object)(object)Player.m_localPlayer != (Object)null) { ((Character)Player.m_localPlayer).Message((MessageType)2, $"<color=#00E5FF>Vessel launched into harbor canal by Crane #{m_craneIndex}! Ready for departure.</color>", 0, (Sprite)null, false); } } private void HandleDetachingAtBerth() { m_stateTimer += Time.deltaTime; ApplyPitch(Mathf.Lerp(22f, 0f, Mathf.Clamp01(m_stateTimer / 1.5f))); if (m_stateTimer > 1.8f) { m_slingsActive = false; m_activeShip = null; m_state = CraneState.ReturningToCenter; m_progress = 0f; } } private void HandleReturningToCenter() { m_progress += Time.deltaTime * 0.25f; float num = Mathf.SmoothStep(0f, 1f, m_progress); m_currentSlewYaw = Mathf.LerpAngle(m_currentSlewYaw, 0f, num); ApplySlewYaw(m_currentSlewYaw); ApplyPitch(0f); if (m_progress >= 1f) { m_currentSlewYaw = 0f; ApplySlewYaw(0f); ApplyPitch(0f); m_state = CraneState.Idle; SetStaticRiggingVisible(visible: true); } } private void UpdateCableVisuals() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_0086: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: 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_01b8: 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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: 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_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: 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_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) if (!m_slingsActive || (Object)(object)m_activeShip == (Object)null) { if ((Object)(object)m_mainCable != (Object)null) { ((Renderer)m_mainCable).enabled = false; } if (m_slingCables == null) { return; } LineRenderer[] slingCables = m_slingCables; foreach (LineRenderer val in slingCables) { if ((Object)(object)val != (Object)null) { ((Renderer)val).enabled = false; } } return; } Vector3 hookTipWorldPosition = GetHookTipWorldPosition(); Vector3 position = ((Component)m_activeShip).transform.position; Vector3 val2 = Vector3.Lerp(hookTipWorldPosition, position + Vector3.up * 4f, 0.45f); if (m_state == CraneState.HarpooningFromBerth || m_state == CraneState.HarpooningFromDryDock) { val2 = Vector3.Lerp(hookTipWorldPosition, val2, m_harpoonProgress); } if ((Object)(object)m_mainCable != (Object)null) { ((Renderer)m_mainCable).enabled = true; m_mainCable.SetPosition(0, hookTipWorldPosition); m_mainCable.SetPosition(1, val2); } float num = 2.4f; float num2 = 6.5f; Vector3 forward = ((Component)m_activeShip).transform.forward; Vector3 right = ((Component)m_activeShip).transform.right; Vector3[] array = (Vector3[])(object)new Vector3[4] { position + forward * num2 - right * num + Vector3.up * 0.8f, position + forward * num2 + right * num + Vector3.up * 0.8f, position - forward * num2 - right * num + Vector3.up * 0.8f, position - forward * num2 + right * num + Vector3.up * 0.8f }; if (m_slingCables == null) { return; } for (int j = 0; j < 4; j++) { if ((Object)(object)m_slingCables[j] != (Object)null) { ((Renderer)m_slingCables[j]).enabled = true; m_slingCables[j].SetPosition(0, val2); Vector3 val3 = array[j]; if (m_state == CraneState.HarpooningFromBerth || m_state == CraneState.HarpooningFromDryDock) { val3 = Vector3.Lerp(val2, array[j], m_harpoonProgress); } m_slingCables[j].SetPosition(1, val3); } } } private void LockShipKinematics(Ship ship) { //IL_001b: 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) if (!((Object)(object)ship == (Object)null)) { Rigidbody component = ((Component)ship).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; component.isKinematic = true; } } } private void ResetCraneState() { m_state = CraneState.Idle; m_activeShip = null; m_activeDock = null; m_slingsActive = false; ApplySlewYaw(0f); ApplyPitch(0f); SetStaticRiggingVisible(visible: true); } private void PlaySound(string sfxName) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNetScene.instance != (Object)null) { GameObject prefab = ZNetScene.instance.GetPrefab(sfxName); if ((Object)(object)prefab != (Object)null) { Object.Instantiate<GameObject>(prefab, ((Component)this).transform.position, Quaternion.identity); } } } private void PlayWaterSplash(Vector3 pos) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNetScene.instance != (Object)null) { GameObject prefab = ZNetScene.instance.GetPrefab("vfx_water_surface"); if ((Object)(object)prefab != (Object)null) { Object.Instantiate<GameObject>(prefab, pos, Quaternion.identity); } GameObject prefab2 = ZNetScene.instance.GetPrefab("sfx_water_splash"); if ((Object)(object)prefab2 != (Object)null) { Object.Instantiate<GameObject>(prefab2, pos, Quaternion.identity); } } } public string GetHoverText() { string text = (IsBusy ? $"<color=yellow>TRANSFER IN PROGRESS ({m_state})</color>" : "<color=#00E5FF>STANDBY AT CANAL QUAY</color>"); string arg = (((Object)(object)m_dryDock != (Object)null) ? m_dryDock.DockName : $"Dock #{m_craneIndex}"); string arg2 = (((Object)(object)m_dryDock != (Object)null && (Object)(object)m_dryDock.DryDockedShip != (Object)null) ? "<color=#A3E635>OCCUPIED</color>" : "<color=#94A3B8>EMPTY</color>"); string text2 = ""; if (!IsBusy) { if ((Object)(object)m_dryDock != (Object)null && (Object)(object)m_dryDock.DryDockedShip != (Object)null) { text2 = $"\n[<color=yellow><b>$KEY_Use</b></color>] Launch Vessel from Dry Dock #{m_craneIndex} to Canal"; } else if ((Object)(object)(((Object)(object)m_gate != (Object)null) ? m_gate.FindMooredShip() : null) != (Object)null) { text2 = $"\n[<color=yellow><b>$KEY_Use</b></color>] Hoist Moored Vessel into Dry Dock #{m_craneIndex}"; } } return Localization.instance.Localize($"<color=#00E5FF><b>Dock Fortress — Giant Crane #{m_craneIndex}</b></color>\n" + $"Assigned Cradle: Dry Dock #{m_craneIndex} ({arg}) [{arg2}]\n" + "Crane Status: " + text + text2); } public string GetHoverName() { return $"Giant Crane #{m_craneIndex}"; } public float GetHoverOffset() { return 0f; } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold || IsBusy) { return false; } if ((Object)(object)m_dryDock != (Object)null && (Object)(object)m_dryDock.DryDockedShip != (Object)null) { return StartLaunchFromDryDock(m_dryDock); } Ship val = (((Object)(object)m_gate != (Object)null) ? m_gate.FindMooredShip() : null); if ((Object)(object)val != (Object)null && (Object)(object)m_dryDock != (Object)null) { return StartHoistToDryDock(val, m_dryDock); } return false; } public bool UseItem(Humanoid user, ItemData item) { return false; } } public static class DockFortressGlb { [Serializable] private class Gltf { public GltfMesh[] meshes; public GltfNode[] nodes; public GltfMaterial[] materials; public GltfAccessor[] accessors; public GltfBufferView[] bufferViews; public GltfImage[] images; public GltfTexture[] textures; public GltfScene[] scenes; } [Serializable] private class GltfMesh { public string name; public GltfPrimitive[] primitives; } [Serializable] private class GltfPrimitive { public GltfAttributes attributes; public int indices = -1; public int material = -1; } [Serializable] private class GltfAttributes { public int POSITION = -1; public int NORMAL = -1; public int TEXCOORD_0 = -1; } [Serializable] private class GltfNode { public string name; public int mesh = -1; public float[] translation; public float[] rotation; public float[] scale; public int[] children; } [Serializable] private class GltfMaterial { public string name; public GltfPbr pbrMetallicRoughness; public GltfTextureInfo normalTexture; } [Serializable] private class GltfPbr { public float[] baseColorFactor; public GltfTextureInfo baseColorTexture; } [Serializable] private class GltfTextureInfo { public int index = -1; } [Serializable] private class GltfImage { public int bufferView = -1; public string name; } [Serializable] private class GltfTexture { public int source = -1; } [Serializable] private class GltfAccessor { public int bufferView; public int byteOffset; public int componentType; public int count; } [Serializable] private class GltfBufferView { public int byteOffset; public int byteLength; public int byteStride; } [Serializable] private class GltfScene { public int[] nodes; } private static readonly Dictionary<string, GameObject> s_cachedPrefabs = new Dictionary<string, GameObject>(); public static GameObject Load(string glbPath, Shader shader, string modelName = "DockFortressModel") { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_0213: 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_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0444: 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_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04be: 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_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(glbPath) || !File.Exists(glbPath)) { Logger.LogWarning((object)("Dock Fortress: model file not found: " + glbPath)); return null; } if (s_cachedPrefabs.TryGetValue(glbPath, out var value) && (Object)(object)value != (Object)null) { GameObject obj = Object.Instantiate<GameObject>(value); obj.SetActive(true); return obj; } try { byte[] array = File.ReadAllBytes(glbPath); if (array.Length < 20 || BitConverter.ToUInt32(array, 0) != 1179937895) { Logger.LogError((object)("Dock Fortress: invalid GLB header: " + glbPath)); return null; } string text = null; byte[] array2 = null; int num = 12; while (num + 8 <= array.Length) { uint num2 = BitConverter.ToUInt32(array, num); uint num3 = BitConverter.ToUInt32(array, num + 4); num += 8; switch (num3) { case 1313821514u: text = Encoding.UTF8.GetString(array, num, (int)num2); break; case 5130562u: array2 = new byte[num2]; Array.Copy(array, num, array2, 0, (int)num2); break; } num += (int)num2; num = (num + 3) & -4; } if (text == null || array2 == null) { Logger.LogError((object)("Dock Fortress: missing JSON or BIN chunk in " + glbPath)); return null; } if ((Object)(object)shader == (Object)null) { shader = FindValidShader(); } Gltf gltf = JsonConvert.DeserializeObject<Gltf>(text); GameObject val = new GameObject(modelName); Material[] materials = BuildMaterials(gltf, array2, shader); Mesh[] array3 = BuildMeshes(gltf, array2); Material[][] array4 = new Material[array3.Length][]; int num4 = 0; while (true) { int num5 = num4; GltfMesh[] meshes = gltf.meshes; if (num5 >= ((meshes != null) ? meshes.Length : 0)) { break; } array4[num4] = MaterialsForMesh(gltf.meshes[num4], materials, shader); num4++; } GltfNode[] nodes = gltf.nodes; GameObject[] array5 = (GameObject[])(object)new GameObject[(nodes != null) ? nodes.Length : 0]; for (int i = 0; i < array5.Length; i++) { GltfNode gltfNode = gltf.nodes[i]; array5[i] = new GameObject(gltfNode.name ?? ("node" + i)); if (gltfNode.translation != null && gltfNode.translation.Length == 3) { array5[i].transform.localPosition = new Vector3(gltfNode.translation[0], gltfNode.translation[1], gltfNode.translation[2]); } if (gltfNode.rotation != null && gltfNode.rotation.Length == 4) { array5[i].transform.localRotation = new Quaternion(gltfNode.rotation[0], gltfNode.rotation[1], gltfNode.rotation[2], gltfNode.rotation[3]); } if (gltfNode.scale != null && gltfNode.scale.Length == 3) { array5[i].transform.localScale = new Vector3(gltfNode.scale[0], gltfNode.scale[1], gltfNode.scale[2]); } if (gltfNode.mesh >= 0 && gltfNode.mesh < array3.Length) { array5[i].AddComponent<MeshFilter>().sharedMesh = array3[gltfNode.mesh]; ((Renderer)array5[i].AddComponent<MeshRenderer>()).sharedMaterials = array4[gltfNode.mesh]; } } bool[] array6 = new bool[array5.Length]; for (int j = 0; j < array5.Length; j++) { if (gltf.nodes[j].children == null) { continue; } int[] children = gltf.nodes[j].children; foreach (int num6 in children) { if (num6 >= 0 && num6 < array5.Length) { array5[num6].transform.SetParent(array5[j].transform, false); array6[num6] = true; } } } if (gltf.scenes != null && gltf.scenes.Length != 0 && gltf.scenes[0].nodes != null) { int[] children = gltf.scenes[0].nodes; foreach (int num7 in children) { if (num7 >= 0 && num7 < array5.Length) { array5[num7].transform.SetParent(val.transform, false); } } } else { for (int l = 0; l < array5.Length; l++) { if (!array6[l]) { array5[l].transform.SetParent(val.transform, false); } } } MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>(true); Bounds val2 = (Bounds)((componentsInChildren.Length != 0) ? ((Renderer)componentsInChildren[0]).bounds : default(Bounds)); for (int m = 1; m < componentsInChildren.Length; m++) { ((Bounds)(ref val2)).Encapsulate(((Renderer)componentsInChildren[m]).bounds); } Logger.LogInfo((object)("Dock Fortress: loaded " + Path.GetFileName(glbPath) + " with " + componentsInChildren.Length + " renderer(s), size " + ((Bounds)(ref val2)).size.x.ToString("0.00") + " x " + ((Bounds)(ref val2)).size.y.ToString("0.00") + " x " + ((Bounds)(ref val2)).size.z.ToString("0.00") + " m.")); val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); s_cachedPrefabs[glbPath] = val; GameObject obj2 = Object.Instantiate<GameObject>(val); obj2.SetActive(true); return obj2; } catch (Exception ex) { Logger.LogError((object)("Dock Fortress: exception loading GLB " + glbPath + ": " + ex)); return null; } } public static Shader FindValidShader() { string[] array = new string[5] { "Custom/Creature", "Custom/Piece", "Custom/StaticObject", "Standard", "Diffuse" }; for (int i = 0; i < array.Length; i++) { Shader val = Shader.Find(array[i]); if ((Object)(object)val != (Object)null) { return val; } } try { Shader[] array2 = Resources.FindObjectsOfTypeAll<Shader>(); foreach (Shader val2 in array2) { if (((Object)val2).name == "Custom/Creature" || ((Object)val2).name == "Custom/Piece" || ((Object)val2).name == "Custom/StaticObject") { return val2; } } } catch { } return Shader.Find("Diffuse") ?? Shader.Find("Unlit/Texture"); } private static Material[] BuildMaterials(Gltf gltf, byte[] bin, Shader shader) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) Texture2D[] array = (Texture2D[])(object)new Texture2D[(gltf.images != null) ? gltf.images.Length : 0]; Material[] array2 = (Material[])(object)new Material[(gltf.materials != null) ? gltf.materials.Length : 0]; for (int i = 0; i < array2.Length; i++) { GltfMaterial gltfMaterial = gltf.materials[i]; Material val = new Material(shader); ((Object)val).name = gltfMaterial.name ?? ("glb_material_" + i); val.color = Color.white; if (val.HasProperty("_Color")) { val.SetColor("_Color", Color.white); } if (val.HasProperty("_BaseColor")) { val.SetColor("_BaseColor", Color.white); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.15f); } if (val.HasProperty("_Smoothness")) { val.SetFloat("_Smoothness", 0.15f); } if (val.HasProperty("_Cutoff")) { val.SetFloat("_Cutoff", 0f); } val.DisableKeyword("_ALPHATEST_ON"); if (val.HasProperty("_Cull")) { val.SetFloat("_Cull", 0f); } GltfPbr pbrMetallicRoughness = gltfMaterial.pbrMetallicRoughness; if (pbrMetallicRoughness != null) { if (pbrMetallicRoughness.baseColorFactor != null && pbrMetallicRoughness.baseColorFactor.Length == 4) { val.color = new Color(pbrMetallicRoughness.baseColorFactor[0], pbrMetallicRoughness.baseColorFactor[1], pbrMetallicRoughness.baseColorFactor[2], pbrMetallicRoughness.baseColorFactor[3]); if (val.HasProperty("_Color")) { val.SetColor("_Color", val.color); } } if (pbrMetallicRoughness.baseColorTexture != null && gltf.textures != null && pbrMetallicRoughness.baseColorTexture.index >= 0 && pbrMetallicRoughness.baseColorTexture.index < gltf.textures.Length) { int source = gltf.textures[pbrMetallicRoughness.baseColorTexture.index].source; if (source >= 0 && source < array.Length) { if ((Object)(object)array[source] == (Object)null) { array[source] = LoadTexture(gltf, bin, source); } if ((Object)(object)array[source] != (Object)null) { val.mainTexture = (Texture)(object)array[source]; if (val.HasProperty("_MainTex")) { val.SetTexture("_MainTex", (Texture)(object)array[source]); } if (val.HasProperty("_BaseMap")) { val.SetTexture("_BaseMap", (Texture)(object)array[source]); } if (val.HasProperty("_Albedo")) { val.SetTexture("_Albedo", (Texture)(object)array[source]); } } } } } if (gltfMaterial.normalTexture != null && gltf.textures != null && gltfMaterial.normalTexture.index >= 0 && gltfMaterial.normalTexture.index < gltf.textures.Length) { int source2 = gltf.textures[gltfMaterial.normalTexture.index].source; if (source2 >= 0 && source2 < array.Length) { if ((Object)(object)array[source2] == (Object)null) { array[source2] = LoadTexture(gltf, bin, source2); } if ((Object)(object)array[source2] != (Object)null && val.HasProperty("_BumpMap")) { val.SetTexture("_BumpMap", (Texture)(object)array[source2]); if ((Object)(object)shader != (Object)null && ((Object)shader).name.Contains("Creature")) { val.EnableKeyword("_NORMALMAP"); } } } } if (!val.HasProperty("_BumpMap") || (Object)(object)val.GetTexture("_BumpMap") == (Object)null) { val.DisableKeyword("_NORMALMAP"); if (val.HasProperty("_BumpMap")) { val.SetTexture("_BumpMap", (Texture)null); } } val.renderQueue = 2000; array2[i] = val; } return array2; } private static Texture2D LoadTexture(Gltf gltf, byte[] bin, int image) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown GltfImage gltfImage = gltf.images[image]; if (gltfImage.bufferView < 0 || gltfImage.bufferView >= gltf.bufferViews.Length) { return null; } GltfBufferView gltfBufferView = gltf.bufferViews[gltfImage.bufferView]; byte[] array = new byte[gltfBufferView.byteLength]; Array.Copy(bin, gltfBufferView.byteOffset, array, 0, gltfBufferView.byteLength); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); if (!ImageConversion.LoadImage(val, array)) { Object.Destroy((Object)(object)val); return null; } ((Texture)val).wrapMode = (TextureWrapMode)0; ((Texture)val).filterMode = (FilterMode)2; ((Texture)val).anisoLevel = 16; ((Texture)val).mipMapBias = -0.5f; return val; } private static Material[] MaterialsForMesh(GltfMesh mesh, Material[] materials, Shader shader) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown Material[] array = (Material[])(object)new Material[mesh.primitives.Length]; for (int i = 0; i < mesh.primitives.Length; i++) { int material = mesh.primitives[i].material; array[i] = (Material)((material >= 0 && material < materials.Length) ? ((object)materials[material]) : ((object)new Material(shader) { color = Color.white })); } return array; } private static Mesh[] BuildMeshes(Gltf gltf, byte[] bin) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) Mesh[] array = (Mesh[])(object)new Mesh[(gltf.meshes != null) ? gltf.meshes.Length : 0]; for (int i = 0; i < array.Length; i++) { GltfMesh gltfMesh = gltf.meshes[i]; Mesh val = new Mesh(); ((Object)val).name = gltfMesh.name ?? ("glb_mesh_" + i); List<Vector3> list = new List<Vector3>(); List<Vector3> list2 = new List<Vector3>(); List<Vector2> list3 = new List<Vector2>(); List<int[]> list4 = new List<int[]>(); GltfPrimitive[] primitives = gltfMesh.primitives; foreach (GltfPrimitive gltfPrimitive in primitives) { int count = list.Count; float[] array2 = ReadFloats(gltf, bin, gltfPrimitive.attributes.POSITION, 3); float[] array3 = ((gltfPrimitive.attributes.NORMAL >= 0) ? ReadFloats(gltf, bin, gltfPrimitive.attributes.NORMAL, 3) : null); float[] array4 = ((gltfPrimitive.attributes.TEXCOORD_0 >= 0) ? ReadFloats(gltf, bin, gltfPrimitive.attributes.TEXCOORD_0, 2) : null); int num = array2.Length / 3; for (int k = 0; k < num; k++) { list.Add(new Vector3(array2[k * 3], array2[k * 3 + 1], array2[k * 3 + 2])); if (array3 != null && array3.Length == array2.Length) { list2.Add(new Vector3(array3[k * 3], array3[k * 3 + 1], array3[k * 3 + 2])); } list3.Add((Vector2)((array4 != null && array4.Length == num * 2) ? new Vector2(array4[k * 2], 1f - array4[k * 2 + 1]) : Vector2.zero)); } int[] array5; if (gltfPrimitive.indices >= 0) { array5 = ReadIndices(gltf, bin, gltfPrimitive.indices); } else { array5 = new int[num]; for (int l = 0; l < num; l++) { array5[l] = l; } } int[] array6 = new int[array5.Length]; for (int m = 0; m < array5.Length; m++) { array6[m] = array5[m] + count; } list4.Add(BothSides(array6)); } if (list.Count > 65535) { val.indexFormat = (IndexFormat)1; } val.SetVertices(list); val.SetUVs(0, list3); val.SetUVs(1, list3); Color[] array7 = (Color[])(object)new Color[list.Count]; for (int n = 0; n < array7.Length; n++) { array7[n] = Color.white; } val.SetColors(array7); val.subMeshCount = list4.Count; for (int num2 = 0; num2 < list4.Count; num2++) { val.SetTriangles(list4[num2], num2); } if (list2.Count == list.Count) { val.SetNormals(list2); } else { val.RecalculateNormals(); } if (list3.Count == list.Count) { val.RecalculateTangents(); } val.RecalculateBounds(); array[i] = val; } return array; } private static int[] BothSides(int[] indices) { int[] array = new int[indices.Length * 2]; for (int i = 0; i < indices.Length; i++) { array[i] = indices[i]; } for (int j = 0; j < indices.Length; j += 3) { int num = indices.Length + j; array[num] = indices[j]; array[num + 1] = indices[j + 2]; array[num + 2] = indices[j + 1]; } return array; } private static float[] ReadFloats(Gltf gltf, byte[] bin, int accessorIndex, int components) { GltfAccessor gltfAccessor = gltf.accessors[accessorIndex]; GltfBufferView gltfBufferView = gltf.bufferViews[gltfAccessor.bufferView]; int num = ((gltfBufferView.byteStride > 0) ? gltfBufferView.byteStride : (components * 4)); int num2 = gltfBufferView.byteOffset + gltfAccessor.byteOffset; float[] array = new float[gltfAccessor.count * components]; for (int i = 0; i < gltfAccessor.count; i++) { for (int j = 0; j < components; j++) { array[i * components + j] = BitConverter.ToSingle(bin, num2 + i * num + j * 4); } } return array; } private static int[] ReadIndices(Gltf gltf, byte[] bin, int accessorIndex) { GltfAccessor gltfAccessor = gltf.accessors[accessorIndex]; GltfBufferView gltfBufferView = gltf.bufferViews[gltfAccessor.bufferView]; int num = ((gltfAccessor.componentType == 5121) ? 1 : ((gltfAccessor.componentType == 5123) ? 2 : 4)); int num2 = ((gltfBufferView.byteStride > 0) ? gltfBufferView.byteStride : num); int num3 = gltfBufferView.byteOffset + gltfAccessor.byteOffset; int[] array = new int[gltfAccessor.count]; for (int i = 0; i < gltfAccessor.count; i++) { int num4 = num3 + i * num2; array[i] = num switch { 2 => BitConverter.ToUInt16(bin, num4), 1 => bin[num4], _ => BitConverter.ToInt32(bin, num4), }; } return array; } } [BepInPlugin("com.dfg.dockfortress", "Dock Fortress", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class DockFortressPlugin : BaseUnityPlugin { public const string PluginGUID = "com.dfg.dockfortress"; public const string PluginName = "Dock Fortress"; public const string PluginVersion = "1.0.0"; public const string GatePrefabName = "piece_dockfortress"; public const string PieceDisplayName = "Dock Fortress Water Gate"; internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<bool> AddBuildPiece; internal static ConfigEntry<float> GateScale; internal static ConfigEntry<float> DetectionRange; internal static ConfigEntry<float> TugSpeed; internal static ConfigEntry<bool> AutoEscort; internal static ConfigEntry<float> BeaconHeight; public static ConfigEntry<float> GateCenterX; public static ConfigEntry<float> GateCenterZ; public static ConfigEntry<float> GateClosedY; public static ConfigEntry<float> GateOpenY; public static ConfigEntry<float> GateWidth; public static ConfigEntry<float> GateHeight; public static ConfigEntry<int> GateBarCount; public static ConfigEntry<float> GateAngle; public static ConfigEntry<float> BeaconPosX; public static ConfigEntry<float> BeaconPosY; public static ConfigEntry<float> BeaconPosZ; public static ConfigEntry<float> PlacementDistance; public static ConfigEntry<float> CraneScale; public static ConfigEntry<float> CranePosX; public static ConfigEntry<float> CranePosY; public static ConfigEntry<float> CranePosZ; public static ConfigEntry<float> CraneAngle; public static ConfigEntry<float> CraneLiftHeight; public static ConfigEntry<float> HelicopterScale; public static ConfigEntry<float> HelicopterFlightAltitude; public static ConfigEntry<float> HelicopterSpeed; public static ConfigEntry<bool> HelicopterPilotVoice; public static ConfigEntry<float> LandingPadScale; public static ConfigEntry<float> LandingPadPosX; public static ConfigEntry<float> LandingPadPosY; public static ConfigEntry<float> LandingPadPosZ; public static ConfigEntry<float> LandingPadAngle; public static ConfigEntry<float> DryDockScale; public static ConfigEntry<float> DryDockPosX; public static ConfigEntry<float> DryDockPosY; public static ConfigEntry<float> DryDockPosZ; public static ConfigEntry<float> DryDockAngle; public static ConfigEntry<bool> DryDockAutoRepair; public static ConfigEntry<bool> AutoDryDockOnArrival; public static ConfigEntry<bool> EnableWebGui; public static ConfigEntry<int> WebGuiPort; private static bool s_prefabRegistered; private static bool s_pieceInTable; private static bool s_pieceKnown; private static float s_retryTimer; private static float s_knownTimer; private static GameObject s_gatePrefab; private static GameObject s_gateModelSource; private static GameObject s_tugModelSource; private static GameObject s_helicopterModelSource; private static GameObject s_landingPadModelSource; private static GameObject s_drydockModelSource; private static DockFortressWebGui s_webGui; private static readonly Queue<Action> s_mainThreadQueue = new Queue<Action>(); private static readonly string[] BasePieceCandidates = new string[5] { "piece_stonefloor4x4", "piece_stonefloor2x2", "piece_stone_wall_4x2", "stone_arch", "piece_groundbeam01" }; private static readonly Dictionary<string, ItemDrop> s_requirementItems = new Dictionary<string, ItemDrop>(); private static MethodInfo s_addKnownPiece; private static MethodInfo s_updatePieces; private Harmony m_harmony; public static GameObject TugModelSource => GetTugModel(); public static GameObject HelicopterModelSource => GetHelicopterModel(); public static GameObject LandingPadModelSource => GetLandingPadModel(); public static GameObject DrydockModelSource => GetDrydockModel(); public static void RunOnMainThread(Action action) { if (action == null) { return; } lock (s_mainThreadQueue) { s_mainThreadQueue.Enqueue(action); } } private void Awake() { //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Expected O, but got Unknown Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "Enabled", true, "Enable the Dock Fortress mod."); AddBuildPiece = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "AddBuildPiece", true, "Add the fortress water gate to the build Hammer."); GateScale = ((BaseUnityPlugin)this).Config.Bind<float>("1 - General", "GateScale", 88f, "Structural scale multiplier for the Dock Fortress (default 88 for colossal harbor portal)."); PlacementDistance = ((BaseUnityPlugin)this).Config.Bind<float>("1 - General", "PlacementDistance", 65f, "Extended build reach distance (meters) into open water."); DetectionRange = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Harbor Master", "DetectionRange", 85f, "Range (meters) to scan for arriving ships to dispatch the escort tugboat."); TugSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Harbor Master", "TugSpeed", 9f, "Cruising speed of the escort tugboat (m/s)."); AutoEscort = ((BaseUnityPlugin)this).Config.Bind<bool>("2 - Harbor Master", "AutoEscort", true, "Automatically dispatch tugboat when player sails into range."); BeaconHeight = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Crimson Beacon", "BeaconHeight", 280f, "Vertical height of the ocean navigation beacon beam."); BeaconPosX = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Crimson Beacon", "BeaconPosX", -3.6f, "Crimson beacon mount X position."); BeaconPosY = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Crimson Beacon", "BeaconPosY", 24.5f, "Crimson beacon mount Y position."); BeaconPosZ = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Crimson Beacon", "BeaconPosZ", -11f, "Crimson beacon mount Z position."); GateCenterX = ((BaseUnityPlugin)this).Config.Bind<float>("4 - Gate Alignment", "GateCenterX", -3.6f, "Portcullis center position along X axis."); GateCenterZ = ((BaseUnityPlugin)this).Config.Bind<float>("4 - Gate Alignment", "GateCenterZ", -11f, "Portcullis center position along Z axis."); GateClosedY = ((BaseUnityPlugin)this).Config.Bind<float>("4 - Gate Alignment", "GateClosedY", 4f, "Portcullis bottom position when closed."); GateOpenY = ((BaseUnityPlugin)this).Config.Bind<float>("4 - Gate Alignment", "GateOpenY", 22f, "Portcullis raised position when opened."); GateWidth = ((BaseUnityPlugin)this).Config.Bind<float>("4 - Gate Alignment", "GateWidth", 16f, "Portcullis passage width opening."); GateHeight = ((BaseUnityPlugin)this).Config.Bind<float>("4 - Gate Alignment", "GateHeight", 18f, "Portcullis vertical height."); GateBarCount = ((BaseUnityPlugin)this).Config.Bind<int>("4 - Gate Alignment", "GateBarCount", 9, "Number of vertical iron portcullis bars."); GateAngle = ((BaseUnityPlugin)this).Config.Bind<float>("4 - Gate Alignment", "GateAngle", 0f, "Portcullis horizontal rotation angle (degrees around Y axis) for aligning with the entrance passage."); CraneScale = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Giant Crane", "CraneScale", 55f, "Structural scale of the giant harbor crane."); CranePosX = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Giant Crane", "CranePosX", -3.6f, "Local X position of the giant crane relative to the fortress (aligned with gate center)."); CranePosY = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Giant Crane", "CranePosY", 0f, "Local Y position of the giant crane."); CranePosZ = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Giant Crane", "CranePosZ", 36f, "Local Z position of the giant crane (set back in the middle basin)."); CraneAngle = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Giant Crane", "CraneAngle", 0f, "Base yaw rotation angle (degrees) of the crane."); CraneLiftHeight = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Giant Crane", "CraneLiftHeight", 18f, "Vertical lift height (meters) during aerial vessel transfer."); HelicopterScale = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Helicopter & Helipad", "HelicopterScale", 14f, "Structural scale of the Sky-Crane Helicopter."); HelicopterFlightAltitude = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Helicopter & Helipad", "HelicopterFlightAltitude", 22f, "Cruising transit flight altitude (meters) above water level."); HelicopterSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Helicopter & Helipad", "HelicopterSpeed", 14f, "Flight speed (m/s) of the Sky-Crane Helicopter."); HelicopterPilotVoice = ((BaseUnityPlugin)this).Config.Bind<bool>("5 - Helicopter & Helipad", "HelicopterPilotVoice", true, "Enable humorous pilot voice lines and speech bubbles for the Sky-Crane Helicopter pilot."); LandingPadScale = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Helicopter & Helipad", "LandingPadScale", 18f, "Scale of the central helicopter landing pad."); LandingPadPosX = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Helicopter & Helipad", "LandingPadPosX", 0f, "Local X position of the central landing pad."); LandingPadPosY = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Helicopter & Helipad", "LandingPadPosY", 3.5f, "Local Y position of the central landing pad."); LandingPadPosZ = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Helicopter & Helipad", "LandingPadPosZ", 62f, "Local Z position of the central landing pad (head of central basin)."); LandingPadAngle = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Helicopter & Helipad", "LandingPadAngle", 0f, "Yaw rotation angle of the landing pad."); DryDockScale = ((BaseUnityPlugin)this).Config.Bind<float>("6 - Dry Dock", "DryDockScale", 38f, "Structural scale of the static grid dry docks."); DryDockPosX = ((BaseUnityPlugin)this).Config.Bind<float>("6 - Dry Dock", "DryDockPosX", -46f, "Local X position offset for port dry docks."); DryDockPosY = ((BaseUnityPlugin)this).Config.Bind<float>("6 - Dry Dock", "DryDockPosY", 0f, "Local Y position of the dry docks."); DryDockPosZ = ((BaseUnityPlugin)this).Config.Bind<float>("6 - Dry Dock", "DryDockPosZ", 16f, "Local Z position of front dry docks."); DryDockAngle = ((BaseUnityPlugin)this).Config.Bind<float>("6 - Dry Dock", "DryDockAngle", 0f, "Yaw rotation angle (degrees) of the dry docks."); DryDockAutoRepair = ((BaseUnityPlugin)this).Config.Bind<bool>("6 - Dry Dock", "DryDockAutoRepair", true, "Automatically restore vessel durability while in dry dock."); AutoDryDockOnArrival = ((BaseUnityPlugin)this).Config.Bind<bool>("6 - Dry Dock", "AutoDryDockOnArrival", false, "Automatically hoist ships into dry dock immediately after tugboat escort."); EnableWebGui = ((BaseUnityPlugin)this).Config.Bind<bool>("7 - Web Tuner", "EnableWebGui", true, "Enable the localhost Web GUI tuner for real-time gate and beacon alignment."); WebGuiPort = ((BaseUnityPlugin)this).Config.Bind<int>("7 - Web Tuner", "WebGuiPort", 8793, "Local port for the Dock Fortress live alignment tuner."); m_harmony = new Harmony("com.dfg.dockfortress"); m_harmony.PatchAll(); PrefabManager.OnVanillaPrefabsAvailable += OnVanillaPrefabsAvailable; PieceManager.OnPiecesRegistered += OnPiecesRegistered; if (EnableWebGui.Value) { StartWebGui(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Dock Fortress v1.0.0 loaded."); } private void OnDestroy() { PrefabManager.OnVanillaPrefabsAvailable -= OnVanillaPrefabsAvailable; PieceManager.OnPiecesRegistered -= OnPiecesRegistered; Harmony harmony = m_harmony; if (harmony != null) { harmony.UnpatchSelf(); } s_webGui?.Stop(); } private void OnVanillaPrefabsAvailable() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Dock Fortress: vanilla prefabs available, initiating registration."); TryRegisterPrefab(); } private void OnPiecesRegistered() { TryAddToHammerTable(); } private void Update() { while (s_mainThreadQueue.Count > 0) { Action action = null; lock (s_mainThreadQueue) { if (s_mainThreadQueue.Count > 0) { action = s_mainThreadQueue.Dequeue(); } } try { action?.Invoke(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Dock Fortress main thread error: " + ex)); } } if (!Enabled.Value || !AddBuildPiece.Value) { return; } s_retryTimer += Time.deltaTime; if (s_retryTimer >= 1f) { s_retryTimer = 0f; if (!s_prefabRegistered) { TryRegisterPrefab(); } else if (!s_pieceInTable) { TryAddToHammerTable(); } } if (s_pieceInTable && !s_pieceKnown) { s_knownTimer += Time.deltaTime; if (s_knownTimer >= 1.5f) { s_knownTimer = 0f; EnsureKnownPiece(); } } } public static GameObject GetTugModel() { if ((Object)(object)s_tugModelSource != (Object)null) { return s_tugModelSource; } string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string glbPath = FindAssetPath("tug.glb", directoryName); Shader shader = DockFortressGlb.FindValidShader(); s_tugModelSource = DockFortressGlb.Load(glbPath, shader, "DockTugModel"); if ((Object)(object)s_tugModelSource != (Object)null) { Object.DontDestroyOnLoad((Object)(object)s_tugModelSource); } return s_tugModelSource; } public static GameObject GetHelicopterModel() { if ((Object)(object)s_helicopterModelSource != (Object)null) { return s_helicopterModelSource; } string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string glbPath = FindAssetPath("helicopter.glb", directoryName); Shader shader = DockFortressGlb.FindValidShader(); s_helicopterModelSource = DockFortressGlb.Load(glbPath, shader, "DockHelicopterModel"); if ((Object)(object)s_helicopterModelSource != (Object)null) { Object.Do