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 UNSC Dropship v0.1.8
BepInEx/plugins/UNSCDropship/UNSCDropship.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; using System.Text; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyVersion("0.0.0.0")] namespace UNSCDropship; public sealed class BarrierContactLogger : MonoBehaviour { private float nextReport; private void OnControllerColliderHit(ControllerColliderHit hit) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) if (Time.unscaledTime < nextReport || Mathf.Abs(hit.normal.y) > 0.6f) { return; } PlayerControllerB component = ((Component)this).GetComponent<PlayerControllerB>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)GameNetworkManager.Instance) && !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)component)) { nextReport = Time.unscaledTime + 2f; string text = ((Object)hit.collider).name; Transform val = ((Component)hit.collider).transform; while (Object.op_Implicit((Object)(object)val.parent)) { val = val.parent; text = ((Object)val).name + "/" + text; } Plugin.Log.LogInfo((object)string.Concat("WALK BARRIER: ", text, " type=", ((object)hit.collider).GetType().Name, " point=", hit.point, " bounds=", hit.collider.bounds)); } } } public sealed class ShipReplacement : MonoBehaviour { private struct TransformState { public Transform parent; public Vector3 position; public Vector3 scale; public Quaternion rotation; } private const string EditMessage = "clair.unscdropship.edit.v2"; private const string Message = "clair.unscdropship.layout.v1"; private const string Request = "clair.unscdropship.request.v1"; private readonly Dictionary<NetworkObject, bool> originalParentSync = new Dictionary<NetworkObject, bool>(); private readonly HashSet<Transform> removedFixtures = new HashSet<Transform>(); private readonly Dictionary<Collider, bool> movingColliders = new Dictionary<Collider, bool>(); private Transform wallFixtures; private readonly HashSet<int> mountedTeleporters = new HashSet<int>(); private readonly Dictionary<string, ShipTeleporter> buttonOwners = new Dictionary<string, ShipTeleporter>(); private int selectedFrame = -1; private bool followAim; private bool validAim; private float rotationOffset; private Movable hovered; private float noticeUntil; private readonly List<Material> lampMaterials = new List<Material>(); private bool lastLampState = true; private int cycleIndex = -1; internal StartOfRound round; internal Transform model; private Transform left; private Transform right; private Vector3 scale; private float fraction; private readonly List<Renderer> hidden = new List<Renderer>(); private readonly List<Collider> disabled = new List<Collider>(); private readonly Dictionary<Collider, bool> cleanupColliderStates = new Dictionary<Collider, bool>(); private readonly List<Mesh> meshes = new List<Mesh>(); private readonly List<Material> materials = new List<Material>(); private readonly Dictionary<Transform, TransformState> originals = new Dictionary<Transform, TransformState>(); private readonly Dictionary<AutoParentToShip, bool> parents = new Dictionary<AutoParentToShip, bool>(); internal readonly Dictionary<string, Movable> movable = new Dictionary<string, Movable>(); private NetworkManager network; private bool initialized; private bool editing; private readonly List<Light> cabinLights = new List<Light>(); private readonly Dictionary<BoxCollider, Vector3[]> boxOriginals = new Dictionary<BoxCollider, Vector3[]>(); private Movable selected; private Vector3 previousPosition; private Quaternion previousRotation; private string status = ""; private float nextSync; private readonly HashSet<ulong> knownClients = new HashSet<ulong>(); private GameObject bridge; internal bool IsEditing => editing; private void RemoveExteriorBarrier() { Transform val = ((Component)this).transform.Find("Railing"); if (!Object.op_Implicit((Object)(object)val)) { return; } int num = 0; Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren<Collider>(true); foreach (Collider val2 in componentsInChildren) { if (SceneCleanupPolicy.CanDisableCollider(val2 is CharacterController, (Object)(object)((Component)val2).GetComponentInParent<PlayerControllerB>() != (Object)null, val2.isTrigger) && !Object.op_Implicit((Object)(object)((Component)val2).GetComponentInParent<PlaceableShipObject>()) && !Object.op_Implicit((Object)(object)((Component)val2).GetComponentInParent<GrabbableObject>())) { val2.enabled = false; disabled.Remove(val2); cleanupColliderStates.Remove(val2); Object.Destroy((Object)(object)val2); num++; } } if (num > 0) { Plugin.Log.LogInfo((object)("REMOVED exterior perimeter collision components: " + num)); } } private void InstallContactLogger() { PlayerControllerB val = (Object.op_Implicit((Object)(object)GameNetworkManager.Instance) ? GameNetworkManager.Instance.localPlayerController : null); if (Object.op_Implicit((Object)(object)val) && !Object.op_Implicit((Object)(object)((Component)val).GetComponent<BarrierContactLogger>())) { ((Component)val).gameObject.AddComponent<BarrierContactLogger>(); } } private void SetFixtureParent(Transform child, Transform parent, bool worldPositionStays = true) { NetworkObject component = ((Component)child).GetComponent<NetworkObject>(); if (Object.op_Implicit((Object)(object)component)) { if (!originalParentSync.ContainsKey(component)) { originalParentSync.Add(component, component.AutoObjectParentSync); } component.AutoObjectParentSync = false; } child.SetParent(parent, worldPositionStays); } private bool IsRemoved(Transform t) { return removedFixtures.Any((Transform root) => Object.op_Implicit((Object)(object)root) && ((Object)(object)t == (Object)(object)root || t.IsChildOf(root))); } private void RemoveHorn() { AutoParentToShip[] array = Object.FindObjectsOfType<AutoParentToShip>(); foreach (AutoParentToShip val in array) { if (!((Object)val).name.StartsWith("ShipHorn", StringComparison.OrdinalIgnoreCase) || removedFixtures.Contains(((Component)val).transform)) { continue; } removedFixtures.Add(((Component)val).transform); HideGeometry(((Component)val).transform); Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren<Collider>(true); foreach (Collider val2 in componentsInChildren) { if (val2.enabled) { disabled.Add(val2); val2.enabled = false; } } InteractTrigger[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<InteractTrigger>(true); foreach (InteractTrigger val3 in componentsInChildren2) { val3.interactable = false; ((Behaviour)val3).enabled = false; } AudioSource[] componentsInChildren3 = ((Component)val).GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val4 in componentsInChildren3) { val4.Stop(); ((Behaviour)val4).enabled = false; } Plugin.Log.LogInfo((object)"Removed ship horn, pull-cord panel, and associated interaction colliders."); } } private PlaceableShipObject NativeItem(Movable m) { if (!Object.op_Implicit((Object)(object)m.root)) { return null; } return ((Component)m.root).GetComponentInChildren<PlaceableShipObject>(true); } private bool IsStored(Movable m) { PlaceableShipObject val = NativeItem(m); if (Object.op_Implicit((Object)(object)val) && val.unlockableID >= 0 && val.unlockableID < round.unlockablesList.unlockables.Count) { return round.unlockablesList.unlockables[val.unlockableID].inStorage; } return false; } internal bool AllowNativeBuild() { if (!initialized) { return true; } if (Object.op_Implicit((Object)(object)ShipBuildModeManager.Instance) && ShipBuildModeManager.Instance.InBuildMode) { return true; } if (editing || !PlayerInCabin()) { return false; } Movable movable = PickFurniture(); if (movable == null) { return true; } if (movable.wallOnly) { return false; } PlaceableShipObject val = NativeItem(movable); if (!Object.op_Implicit((Object)(object)val)) { return false; } SyncNative(movable); return true; } private void SyncNative(Movable m) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //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) if (!m.wallOnly) { PlaceableShipObject val = NativeItem(m); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.parentObject)) { AutoParentToShip parentObject = val.parentObject; parentObject.positionOffset = ((Component)this).transform.InverseTransformPoint(((Component)parentObject).transform.position); Quaternion val2 = Quaternion.Inverse(((Component)this).transform.rotation) * ((Component)parentObject).transform.rotation; parentObject.rotationOffset = ((Quaternion)(ref val2)).eulerAngles; ((Behaviour)parentObject).enabled = true; } } } private void RestoreNativeFurniture() { foreach (Movable value in movable.Values) { SyncNative(value); } } private void MaintainNativeStorage() { KeyValuePair<string, ShipTeleporter>[] array = buttonOwners.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair<string, ShipTeleporter> keyValuePair = array[i]; if (!movable.TryGetValue(keyValuePair.Key, out var value)) { continue; } if (!Object.op_Implicit((Object)(object)keyValuePair.Value)) { if (Object.op_Implicit((Object)(object)value.root)) { Object.Destroy((Object)(object)((Component)value.root).gameObject); } movable.Remove(keyValuePair.Key); buttonOwners.Remove(keyValuePair.Key); } else { PlaceableShipObject componentInChildren = ((Component)keyValuePair.Value).GetComponentInChildren<PlaceableShipObject>(true); bool flag = Object.op_Implicit((Object)(object)componentInChildren) && componentInChildren.unlockableID >= 0 && componentInChildren.unlockableID < round.unlockablesList.unlockables.Count && round.unlockablesList.unlockables[componentInChildren.unlockableID].inStorage; ((Component)value.root).gameObject.SetActive(((Component)keyValuePair.Value).gameObject.activeInHierarchy && !flag); } } foreach (Movable value2 in movable.Values) { if (Object.op_Implicit((Object)(object)value2.root) && !value2.wallOnly && value2 != selected) { PlaceableShipObject val = NativeItem(value2); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.parentObject) && !((Behaviour)val.parentObject).enabled) { ((Behaviour)val.parentObject).enabled = true; } } } } private void FreezeForMove(Movable m) { PlaceableShipObject val = NativeItem(m); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.parentObject)) { ((Behaviour)val.parentObject).enabled = false; } movingColliders.Clear(); Collider[] componentsInChildren = ((Component)m.root).GetComponentsInChildren<Collider>(true); foreach (Collider val2 in componentsInChildren) { if (!(val2 is CharacterController) && !Object.op_Implicit((Object)(object)((Component)val2).GetComponentInParent<PlayerControllerB>())) { movingColliders[val2] = val2.enabled; val2.enabled = false; } } Physics.SyncTransforms(); } private void ResumeAfterMove(Movable m) { foreach (KeyValuePair<Collider, bool> movingCollider in movingColliders) { if (Object.op_Implicit((Object)(object)movingCollider.Key) && !disabled.Contains(movingCollider.Key)) { movingCollider.Key.enabled = movingCollider.Value; } } movingColliders.Clear(); SyncNative(m); Physics.SyncTransforms(); } private bool PlacementTouchesPlayer(Movable m) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) Bounds val = BoundsOf(m.root); PlayerControllerB[] allPlayerScripts = round.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (Object.op_Implicit((Object)(object)val2) && val2.isPlayerControlled && !val2.isPlayerDead) { CharacterController component = ((Component)val2).GetComponent<CharacterController>(); if (Object.op_Implicit((Object)(object)component) && ((Bounds)(ref val)).Intersects(((Collider)component).bounds)) { return true; } } } return false; } private void ValidateLeverAssembly() { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)this).transform.Find("UNSC_CommandConsole"); Transform val2 = (Object.op_Implicit((Object)(object)val) ? val.Find("StartGameLever") : null); if (!Object.op_Implicit((Object)(object)val2)) { Plugin.Log.LogError((object)"Launch lever is missing from the console assembly."); return; } InteractTrigger[] componentsInChildren = ((Component)val2).GetComponentsInChildren<InteractTrigger>(true); Plugin.Log.LogInfo((object)("LEVER CHECK: parent=" + ((Object)val2.parent).name + "; attached interaction triggers=" + componentsInChildren.Length)); InteractTrigger[] array = componentsInChildren; foreach (InteractTrigger val3 in array) { Plugin.Log.LogInfo((object)("LEVER TRIGGER " + ((Object)val3).name + " at " + ((Component)this).transform.InverseTransformPoint(((Component)val3).transform.position))); } } private string ColliderPath(Transform t) { string text = ((Object)t).name; for (int i = 0; i < 5; i++) { if (!Object.op_Implicit((Object)(object)t.parent)) { break; } t = t.parent; text = ((Object)t).name + "/" + text; } return text; } private void LogPlayerBlockers() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_007a: 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_008b: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = (Object.op_Implicit((Object)(object)GameNetworkManager.Instance) ? GameNetworkManager.Instance.localPlayerController : null); if (!Object.op_Implicit((Object)(object)val)) { return; } CharacterController component = ((Component)val).GetComponent<CharacterController>(); if (!Object.op_Implicit((Object)(object)component)) { return; } Vector3 val2 = ((Component)val).transform.TransformPoint(component.center); float num = component.radius * 0.95f; float num2 = Mathf.Max(0f, component.height * 0.5f - num); Collider[] array = Physics.OverlapCapsule(val2 + ((Component)this).transform.up * num2, val2 - ((Component)this).transform.up * num2, num, -1, (QueryTriggerInteraction)1); Collider[] array2 = array; foreach (Collider val3 in array2) { if ((Object)(object)val3 != (Object)(object)component && !((Component)val3).transform.IsChildOf(((Component)val).transform) && !Physics.GetIgnoreLayerCollision(((Component)component).gameObject.layer, ((Component)val3).gameObject.layer)) { Plugin.Log.LogWarning((object)string.Concat("PLAYER BLOCKER ", ColliderPath(((Component)val3).transform), " bounds=", val3.bounds, " type=", ((object)val3).GetType().Name)); } } Plugin.Log.LogInfo((object)string.Concat("PLAYER MOVEMENT: position=", ((Component)this).transform.InverseTransformPoint(((Component)val).transform.position), " controllerEnabled=", ((Collider)component).enabled, " inTerminal=", val.inTerminalMenu, " editing=", editing)); } private void RepairMirroredColliders() { //IL_006d: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) Collider[] componentsInChildren = ((Component)((Component)this).transform).GetComponentsInChildren<Collider>(true); Vector3 signs = default(Vector3); foreach (Collider val in componentsInChildren) { if (!val.enabled || val.isTrigger || val is CharacterController || Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<PlayerControllerB>()) || Object.op_Implicit((Object)(object)((Component)val).GetComponent<InteractTrigger>())) { continue; } Vector3 lossyScale = ((Component)val).transform.lossyScale; if (lossyScale.x >= 0f && lossyScale.y >= 0f && lossyScale.z >= 0f) { continue; } ref Vector3 reference = ref signs; reference = new Vector3((float)((!(lossyScale.x < 0f)) ? 1 : (-1)), (float)((!(lossyScale.y < 0f)) ? 1 : (-1)), (float)((!(lossyScale.z < 0f)) ? 1 : (-1))); GameObject val2 = new GameObject("PositiveScaleCollision"); val2.layer = ((Component)val).gameObject.layer; val2.transform.SetParent(((Component)val).transform, false); val2.transform.localScale = signs; BoxCollider val3 = (BoxCollider)(object)((val is BoxCollider) ? val : null); MeshCollider val4 = (MeshCollider)(object)((val is MeshCollider) ? val : null); if (Object.op_Implicit((Object)(object)val3)) { BoxCollider val5 = val2.AddComponent<BoxCollider>(); val5.center = Vector3.Scale(val3.center, signs); val5.size = val3.size; ((Collider)val5).sharedMaterial = ((Collider)val3).sharedMaterial; } else { if (!Object.op_Implicit((Object)(object)val4) || !Object.op_Implicit((Object)(object)val4.sharedMesh)) { Object.Destroy((Object)(object)val2); continue; } if (val4.sharedMesh.isReadable) { Mesh val6 = Object.Instantiate<Mesh>(val4.sharedMesh); ((Object)val6).name = "MirroredCollision"; val6.vertices = val6.vertices.Select((Vector3 v) => Vector3.Scale(v, signs)).ToArray(); int[] triangles = val6.triangles; if (signs.x * signs.y * signs.z < 0f) { for (int num = 0; num < triangles.Length; num += 3) { int num2 = triangles[num]; triangles[num] = triangles[num + 2]; triangles[num + 2] = num2; } } val6.triangles = triangles; val6.RecalculateBounds(); meshes.Add(val6); val2.AddComponent<MeshCollider>().sharedMesh = val6; } else { BoxCollider val7 = val2.AddComponent<BoxCollider>(); Bounds bounds = val4.sharedMesh.bounds; val7.center = Vector3.Scale(((Bounds)(ref bounds)).center, signs); Bounds bounds2 = val4.sharedMesh.bounds; val7.size = ((Bounds)(ref bounds2)).size; } } disabled.Add(val); val.enabled = false; Plugin.Log.LogInfo((object)("Repaired mirrored collider " + ColliderPath(((Component)val).transform))); } } private bool ClearPlayerSpace(Vector3 feet, CharacterController controller) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) float num = controller.radius * 0.95f; float height = controller.height; Collider[] array = Physics.OverlapCapsule(feet + ((Component)this).transform.up * (num + 0.08f), feet + ((Component)this).transform.up * (height - num + 0.08f), num, -1, (QueryTriggerInteraction)1); foreach (Collider val in array) { if (!((Object)(object)val == (Object)(object)controller) && !((Component)val).transform.IsChildOf(((Component)controller).transform) && !Physics.GetIgnoreLayerCollision(((Component)controller).gameObject.layer, ((Component)val).gameObject.layer)) { return false; } } return true; } private void RepairInitialSpawn() { //IL_004f: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00eb: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = (Object.op_Implicit((Object)(object)GameNetworkManager.Instance) ? GameNetworkManager.Instance.localPlayerController : null); if (!Object.op_Implicit((Object)(object)val) || val.isPlayerDead || !PlayerInCabin()) { return; } CharacterController component = ((Component)val).GetComponent<CharacterController>(); if (!Object.op_Implicit((Object)(object)component)) { return; } Physics.SyncTransforms(); if (ClearPlayerSpace(((Component)val).transform.position, component)) { return; } LogPlayerBlockers(); float[] array = new float[7] { -5.4f, -4.6f, -3.7f, -2.7f, -1.6f, 0f, 1.5f }; foreach (float z in array) { float[] array2 = new float[3] { 0f, -0.7f, 0.7f }; foreach (float x in array2) { Vector3 val2 = P(x, 0.55f, z); if (ClearPlayerSpace(val2, component)) { val.TeleportPlayer(val2, false, 0f, false, true); Plugin.Log.LogInfo((object)("Moved locally blocked spawn into clear cabin space: " + ((Component)this).transform.InverseTransformPoint(val2))); return; } } } Plugin.Log.LogWarning((object)"No clear spawn capsule found; F8 logs blocking colliders for diagnosis."); } private void AddCockpitLight(Type hdType) { //IL_003a: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_0101: 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_00af: 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) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "Cockpit light"; val.transform.SetParent(((Component)this).transform, false); val.transform.position = P(0f, 2.8f, 6.3f); val.transform.localScale = new Vector3(0.4f, 0.06f, 0.6f); Material val2 = new Material(materials[0]); materials.Add(val2); lampMaterials.Add(val2); if (val2.HasProperty("_EmissiveColor")) { val2.SetColor("_EmissiveColor", new Color(0.85f, 0.9f, 1f) * 1.5f); } val.GetComponent<Renderer>().sharedMaterial = val2; GameObject val3 = new GameObject("Soft front light"); val3.transform.SetParent(val.transform, false); val3.transform.localPosition = new Vector3(0f, -2f, 0f); Light val4 = val3.AddComponent<Light>(); val4.type = (LightType)2; val4.range = 7f; val4.color = new Color(0.95f, 0.92f, 0.85f); val4.shadows = (LightShadows)0; if (hdType != null) { Component obj = val3.AddComponent(hdType); PropertyInfo property = hdType.GetProperty("intensity"); if (property != null && property.CanWrite) { property.SetValue(obj, 450f, null); } else { val4.intensity = 450f; } } else { val4.intensity = 1f; } cabinLights.Add(val4); Register("Cockpit light", val.transform, centerPivot: true); } private void MakeWallFixture(string id, Transform content, Vector3 front, Vector3 up, Vector3 localPoint, Vector3 localNormal) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_001a: 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_0097: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_0156: 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_01c8: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) Remember(content); if (!Object.op_Implicit((Object)(object)wallFixtures)) { wallFixtures = new GameObject("UNSC_WallFixtures").transform; wallFixtures.SetParent(((Component)this).transform, false); } Transform transform = new GameObject(id).transform; transform.SetParent(wallFixtures, false); Bounds val = BoundsOf(content); transform.position = ((Bounds)(ref val)).center; if (Mathf.Abs(Vector3.Dot(((Vector3)(ref front)).normalized, ((Vector3)(ref up)).normalized)) > 0.95f) { up = ((Component)this).transform.up; } transform.rotation = Quaternion.LookRotation(front, up); SetFixtureParent(content, transform); Bounds val2 = GeometryBounds(content, transform); content.localPosition -= new Vector3(((Bounds)(ref val2)).center.x, ((Bounds)(ref val2)).center.y, ((Bounds)(ref val2)).min.z); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val3).name = "Wall mounting plate"; val3.transform.SetParent(transform, false); val3.transform.localPosition = new Vector3(0f, 0f, -0.025f); val3.transform.localScale = new Vector3(Mathf.Max(0.25f, ((Bounds)(ref val2)).size.x + 0.06f), Mathf.Max(0.25f, ((Bounds)(ref val2)).size.y + 0.06f), 0.05f); val3.layer = ((Component)((Component)this).transform.Find("ShipInside")).gameObject.layer; val3.GetComponent<Renderer>().sharedMaterial = materials[0]; transform.position = P(localPoint.x, localPoint.y, localPoint.z); transform.rotation = Quaternion.LookRotation(model.TransformDirection(localNormal), ((Component)this).transform.up); Register(id, transform, centerPivot: false); movable[id].wallOnly = true; if (((Component)model).gameObject.activeInHierarchy) { SnapWallFixture(movable[id]); } Plugin.Log.LogInfo((object)string.Concat("Mounted wall fixture ", id, " at ", localPoint, "; face=", localNormal)); } private void SnapWallFixture(Movable m) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) Physics.SyncTransforms(); Vector3 forward = m.root.forward; foreach (RaycastHit item in from h in Physics.RaycastAll(m.root.position + forward * 0.15f, -forward, 0.75f, -1, (QueryTriggerInteraction)1) orderby ((RaycastHit)(ref h)).distance select h) { RaycastHit current = item; if (((RaycastHit)(ref current)).transform.IsChildOf(model) && ((Object)((RaycastHit)(ref current)).transform).name.StartsWith("Structure_")) { m.root.position = ((RaycastHit)(ref current)).point + forward * 0.035f; m.initial = m.root.localPosition; m.rotation = m.root.localRotation; return; } } Plugin.Log.LogWarning((object)("No backing wall found for " + m.id + "; use B to choose a wall.")); } private void MountLightSwitch() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_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) Transform val = ((Component)this).transform.Find("LightSwitchContainer"); if (Object.op_Implicit((Object)(object)val)) { Transform val2 = val.Find("LightSwitch"); if (!Object.op_Implicit((Object)(object)val2)) { val2 = val; } MakeWallFixture("Light switch", val, val2.TransformVector(Vector3.up), val2.TransformVector(Vector3.forward), new Vector3(2.85f, 1.6f, -4.4f), Vector3.left); } } private void CreateQuotaMonitor() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00c9: 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)this).transform.Find("ShipModels2b/MonitorWall"); if (!Object.op_Implicit((Object)(object)val)) { return; } Transform val2 = val.Find("Cube"); Transform val3 = val.Find("SingleScreen"); if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val3)) { return; } MeshFilter component = ((Component)val3).GetComponent<MeshFilter>(); MeshRenderer component2 = ((Component)val3).GetComponent<MeshRenderer>(); MeshRenderer component3 = ((Component)val2).GetComponent<MeshRenderer>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component3)) { GameObject val4 = new GameObject("QuotaMonitor"); val4.layer = ((Component)((Component)this).transform.Find("ShipInside")).gameObject.layer; val4.transform.SetParent(((Component)this).transform, false); val4.transform.localScale = Vector3.one * 0.65f; val4.AddComponent<MeshFilter>().sharedMesh = component.sharedMesh; Material[] array = ((Renderer)component2).sharedMaterials.ToArray(); Material val5 = ((IEnumerable<Material>)((Renderer)component3).sharedMaterials).FirstOrDefault((Func<Material, bool>)((Material x) => Object.op_Implicit((Object)(object)x) && ((Object)x).name.Contains("ShipScreen1"))); if (Object.op_Implicit((Object)(object)val5) && array.Length > 1) { array[1] = val5; } ((Renderer)val4.AddComponent<MeshRenderer>()).sharedMaterials = array; BoxCollider val6 = val4.AddComponent<BoxCollider>(); Bounds bounds = component.sharedMesh.bounds; val6.center = ((Bounds)(ref bounds)).center; Bounds bounds2 = component.sharedMesh.bounds; val6.size = ((Bounds)(ref bounds2)).size; MakeWallFixture("Quota monitor", val4.transform, val4.transform.TransformVector(new Vector3(-0.9586f, -0.2848f, 0f)), val4.transform.up, new Vector3(2.85f, 2.1f, -2.5f), Vector3.left); } HideGeometry(val2); HideGeometry(val3); Light[] componentsInChildren = ((Component)val3).GetComponentsInChildren<Light>(true); foreach (Light val7 in componentsInChildren) { ((Behaviour)val7).enabled = false; } Plugin.Log.LogInfo((object)"Removed two upper console screens; quota material moved to standalone wall monitor."); } private void MountTeleporterButtons() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00ec: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) ShipTeleporter[] array = Object.FindObjectsOfType<ShipTeleporter>(); foreach (ShipTeleporter val in array) { if (mountedTeleporters.Contains(((Object)val).GetInstanceID()) || !Object.op_Implicit((Object)(object)val.buttonAnimator)) { continue; } string text = (val.isInverseTeleporter ? "Inverse teleporter buttons" : "Teleporter buttons"); if (movable.ContainsKey(text)) { continue; } Transform transform = ((Component)val.buttonAnimator).transform; if ((Object)(object)transform == (Object)(object)((Component)val).transform) { Plugin.Log.LogWarning((object)"Teleporter button animator is on machine root; no safe button assembly found."); continue; } Vector3 forward = transform.forward; Vector3 up = transform.up; Transform parent = transform.parent; Vector3 localPosition = (Object.op_Implicit((Object)(object)val.buttonTrigger) ? transform.InverseTransformPoint(((Component)val.buttonTrigger).transform.position) : Vector3.zero); Quaternion localRotation = (Object.op_Implicit((Object)(object)val.buttonTrigger) ? (Quaternion.Inverse(transform.rotation) * ((Component)val.buttonTrigger).transform.rotation) : Quaternion.identity); MakeWallFixture(text, transform, forward, up, new Vector3(-2.85f, 1.6f, val.isInverseTeleporter ? (-0.8f) : (-2.2f)), Vector3.right); Transform root = movable[text].root; if (Object.op_Implicit((Object)(object)val.buttonTrigger) && !((Component)val.buttonTrigger).transform.IsChildOf(root)) { Transform transform2 = ((Component)val.buttonTrigger).transform; Remember(transform2); transform2.SetParent(transform, true); transform2.localPosition = localPosition; transform2.localRotation = localRotation; } if (Object.op_Implicit((Object)(object)val.buttonAudio) && !((Component)val.buttonAudio).transform.IsChildOf(root)) { Remember(((Component)val.buttonAudio).transform); ((Component)val.buttonAudio).transform.SetParent(transform, false); } if (Object.op_Implicit((Object)(object)parent)) { Transform val2 = parent.Find("LongCord"); if (Object.op_Implicit((Object)(object)val2)) { HideGeometry(val2); } } buttonOwners[text] = val; mountedTeleporters.Add(((Object)val).GetInstanceID()); RefreshSelection(movable[text]); } } private void AddCabinLighting() { //IL_0074: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_018c: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) Type type = Type.GetType("UnityEngine.Rendering.HighDefinition.HDAdditionalLightData, Unity.RenderPipelines.HighDefinition.Runtime"); int num = 0; for (int i = 0; i < 4; i++) { for (int j = -1; j <= 1; j += 2) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "Ceiling light " + ++num; val.transform.SetParent(((Component)this).transform, false); val.transform.position = P((float)j * 1.55f, 3.25f, -5.2f + (float)i * 3.15f); val.transform.rotation = ((Component)this).transform.rotation; val.transform.localScale = new Vector3(0.65f, 0.08f, 0.18f); Material val2 = new Material(materials[0]); materials.Add(val2); lampMaterials.Add(val2); if (val2.HasProperty("_BaseColor")) { val2.SetColor("_BaseColor", new Color(0.85f, 0.9f, 1f)); } if (val2.HasProperty("_EmissiveColor")) { val2.SetColor("_EmissiveColor", new Color(0.85f, 0.9f, 1f) * 1.5f); } val.GetComponent<Renderer>().sharedMaterial = val2; GameObject val3 = new GameObject("Light"); val3.transform.SetParent(val.transform, false); val3.transform.localPosition = new Vector3(0f, -2f, 0f); Light val4 = val3.AddComponent<Light>(); val4.type = (LightType)2; val4.color = new Color(0.9f, 0.94f, 1f); val4.range = 9f; val4.shadows = (LightShadows)0; if (type != null) { Component obj = val3.AddComponent(type); PropertyInfo property = type.GetProperty("intensity"); if (property != null && property.CanWrite) { property.SetValue(obj, 650f, null); } else { val4.intensity = 650f; } } else { val4.intensity = 1.5f; } cabinLights.Add(val4); Register(((Object)val).name, val.transform, centerPivot: true); } } AddCockpitLight(type); Plugin.Log.LogInfo((object)"Added eight HDRP cabin lights at 650 intensity with vanilla switch control."); } private void ConfigureSelection() { foreach (Movable value in movable.Values) { RefreshSelection(value); } } private void RefreshSelection(Movable m) { m.renderers = (from r in ((Component)m.root).GetComponentsInChildren<Renderer>(true) where r.enabled && r is MeshRenderer && !hidden.Contains(r) select r).ToArray(); AutoParentToShip[] componentsInChildren = ((Component)m.root).GetComponentsInChildren<AutoParentToShip>(true); foreach (AutoParentToShip val in componentsInChildren) { if (!parents.ContainsKey(val)) { parents.Add(val, ((Behaviour)val).enabled); } ((Behaviour)val).enabled = false; } } private void DiscoverFurniture() { PlaceableShipObject[] array = Object.FindObjectsOfType<PlaceableShipObject>(); foreach (PlaceableShipObject val in array) { Transform t = (Object.op_Implicit((Object)(object)val.parentObjectSecondary) ? val.parentObjectSecondary : (Object.op_Implicit((Object)(object)val.parentObject) ? ((Component)val.parentObject).transform : ((Component)val).transform)); if (Object.op_Implicit((Object)(object)t) && !IsRemoved(t) && !movable.Values.Any((Movable m) => (Object)(object)t == (Object)(object)m.root || t.IsChildOf(m.root) || m.root.IsChildOf(t)) && (t.IsChildOf(((Component)this).transform) || Object.op_Implicit((Object)(object)val.parentObject))) { string text = "Stock_" + val.unlockableID; if (!movable.ContainsKey(text)) { Register(text, t, centerPivot: false); RefreshSelection(movable[text]); } } } } private bool PlayerInCabin() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = (Object.op_Implicit((Object)(object)GameNetworkManager.Instance) ? GameNetworkManager.Instance.localPlayerController : null); if (!Object.op_Implicit((Object)(object)val) || val.isPlayerDead || val.inTerminalMenu) { return false; } Vector3 val2 = model.InverseTransformPoint(((Component)val).transform.position); if (Mathf.Abs(val2.x) < 3.5f && val2.y > -0.5f && val2.y < 4.7f && val2.z > -8f) { return val2.z < 9f; } return false; } internal bool HandleBuildKey() { if (!initialized || !PlayerInCabin()) { return false; } if (selected != null) { ConfirmSelection(); return true; } hovered = PickFurniture(); if (hovered == null) { status = "Aim at a visible furnishing; F7 opens the editor."; noticeUntil = Time.unscaledTime + 4f; return true; } editing = true; Select(hovered, aim: true); return true; } private Movable PickFurniture() { //IL_0018: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)localPlayerController.gameplayCamera).transform.position, ((Component)localPlayerController.gameplayCamera).transform.forward); Movable result = null; float num = 8f; Ray val3 = default(Ray); float num2 = default(float); foreach (Movable value in movable.Values) { if (!Object.op_Implicit((Object)(object)value.root) || IsStored(value)) { continue; } if (value.renderers == null) { RefreshSelection(value); } Renderer[] renderers = value.renderers; foreach (Renderer val2 in renderers) { if (!Object.op_Implicit((Object)(object)val2) || !val2.enabled || !((Component)val2).gameObject.activeInHierarchy) { continue; } MeshFilter component = ((Component)val2).GetComponent<MeshFilter>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.sharedMesh)) { continue; } Transform transform = ((Component)component).transform; ((Ray)(ref val3))..ctor(transform.InverseTransformPoint(((Ray)(ref val)).origin), transform.InverseTransformVector(((Ray)(ref val)).direction)); Bounds bounds = component.sharedMesh.bounds; if (((Bounds)(ref bounds)).IntersectRay(val3, ref num2)) { float num3 = Vector3.Distance(((Ray)(ref val)).origin, transform.TransformPoint(((Ray)(ref val3)).GetPoint(num2))); if (num3 < num) { num = num3; result = value; } } } } return result; } private void Select(Movable m, bool aim) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) selected = m; previousPosition = m.root.localPosition; previousRotation = m.root.localRotation; selectedFrame = Time.frameCount; followAim = aim; validAim = !m.wallOnly; rotationOffset = 0f; FreezeForMove(m); ShipBuildModeManager instance = ShipBuildModeManager.Instance; if (Object.op_Implicit((Object)(object)instance) && instance.InBuildMode) { instance.CancelBuildMode(true); } status = "Moving " + m.id + (m.wallOnly ? " — aim at a cabin wall" : ""); Plugin.Log.LogInfo((object)("MOVE SELECT " + m.id + " wallOnly=" + m.wallOnly)); } private void EditorUpdate() { //IL_0081: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: 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_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) bool flag = !Object.op_Implicit((Object)(object)round.shipRoomLights) || round.shipRoomLights.areLightsOn; if (flag != lastLampState) { lastLampState = flag; foreach (Material lampMaterial in lampMaterials) { if (Object.op_Implicit((Object)(object)lampMaterial) && lampMaterial.HasProperty("_EmissiveColor")) { lampMaterial.SetColor("_EmissiveColor", flag ? (new Color(0.85f, 0.9f, 1f) * 1.5f) : Color.black); } } } Keyboard current2 = Keyboard.current; Mouse current3 = Mouse.current; if (current2 == null || current3 == null) { return; } if (((ButtonControl)current2.f8Key).wasPressedThisFrame) { Dump(); LogPlayerBlockers(); } if (((ButtonControl)current2.f7Key).wasPressedThisFrame) { editing = !editing; if (!editing) { CancelSelection(); } else { status = "Aim and click a furnishing, or press B. Tab cycles furnishings."; } } if (!PlayerInCabin()) { if (editing) { status = "Enter the cabin to edit furnishings."; } return; } hovered = PickFurniture(); if (!editing) { return; } if (selected == null) { if (current3.leftButton.wasPressedThisFrame && hovered != null) { Select(hovered, aim: true); } if (((ButtonControl)current2.tabKey).wasPressedThisFrame) { Movable[] array = (from m in movable.Values where Object.op_Implicit((Object)(object)m.root) && ((Component)m.root).gameObject.activeInHierarchy orderby m.id select m).ToArray(); if (array.Length > 0) { cycleIndex = (cycleIndex + 1) % array.Length; Select(array[cycleIndex], aim: false); } } if (!((ButtonControl)current2.backspaceKey).wasPressedThisFrame || (Object.op_Implicit((Object)(object)network) && !network.IsServer)) { return; } foreach (Movable value in movable.Values) { value.root.localPosition = value.initial; value.root.localRotation = value.rotation; } SaveLayout(); Broadcast(); status = "Default layout restored."; } else { if (Time.frameCount == selectedFrame) { return; } if (current3.rightButton.wasPressedThisFrame || ((ButtonControl)current2.escapeKey).wasPressedThisFrame) { CancelSelection(); return; } if (((ButtonControl)current2.tabKey).wasPressedThisFrame) { CancelSelection(); return; } if (((ButtonControl)current2.rKey).isPressed && !selected.wallOnly) { rotationOffset += 80f * Time.deltaTime; } if (followAim) { PlaceAtAim(); } else { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((float)((((ButtonControl)current2.rightArrowKey).isPressed ? 1 : 0) - (((ButtonControl)current2.leftArrowKey).isPressed ? 1 : 0)), (float)((((ButtonControl)current2.pageUpKey).isPressed ? 1 : 0) - (((ButtonControl)current2.pageDownKey).isPressed ? 1 : 0)), (float)((((ButtonControl)current2.upArrowKey).isPressed ? 1 : 0) - (((ButtonControl)current2.downArrowKey).isPressed ? 1 : 0))); if (selected.wallOnly) { followAim = true; PlaceAtAim(); } else { Transform root = selected.root; root.position += model.TransformDirection(val) * Time.deltaTime * (((ButtonControl)current2.leftShiftKey).isPressed ? 2f : 0.6f); if (((ButtonControl)current2.qKey).isPressed) { selected.root.Rotate(((Component)this).transform.up, -60f * Time.deltaTime, (Space)0); } if (((ButtonControl)current2.eKey).isPressed) { selected.root.Rotate(((Component)this).transform.up, 60f * Time.deltaTime, (Space)0); } validAim = true; } } Physics.SyncTransforms(); if (((ButtonControl)current2.enterKey).wasPressedThisFrame || current3.leftButton.wasPressedThisFrame) { ConfirmSelection(); } } } private void PlaceAtAim() { //IL_0018: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0260: 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_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)localPlayerController.gameplayCamera).transform.position, ((Component)localPlayerController.gameplayCamera).transform.forward); IOrderedEnumerable<RaycastHit> orderedEnumerable = from h in Physics.RaycastAll(val, 12f, -1, (QueryTriggerInteraction)1) orderby ((RaycastHit)(ref h)).distance select h; validAim = false; foreach (RaycastHit item in orderedEnumerable) { RaycastHit current = item; if (!((RaycastHit)(ref current)).transform.IsChildOf(model) || !((Object)((RaycastHit)(ref current)).transform).name.StartsWith("Structure_")) { continue; } Vector3 val2 = model.InverseTransformPoint(((RaycastHit)(ref current)).point); Vector3 val3 = ((RaycastHit)(ref current)).normal; if (Vector3.Dot(val3, ((Ray)(ref val)).direction) > 0f) { val3 = -val3; } if (selected.wallOnly) { if (!(Mathf.Abs(Vector3.Dot(val3, ((Component)this).transform.up)) > 0.35f) && !(Mathf.Abs(val2.x) > 3.15f) && !(val2.z < -7.25f) && !(val2.z > 6.8f) && !(val2.y < 0.8f) && !(val2.y > 3.4f)) { selected.root.rotation = Quaternion.LookRotation(val3, ((Component)this).transform.up); selected.root.position = ((RaycastHit)(ref current)).point + val3 * 0.035f; validAim = true; return; } } else if (!(Vector3.Dot(val3, ((Component)this).transform.up) < 0.8f)) { selected.root.rotation = Quaternion.AngleAxis(rotationOffset, ((Component)this).transform.up) * selected.root.parent.rotation * previousRotation; Bounds val4 = BoundsOf(selected.root); Transform root = selected.root; root.position += ((RaycastHit)(ref current)).point - new Vector3(((Bounds)(ref val4)).center.x, ((Bounds)(ref val4)).min.y, ((Bounds)(ref val4)).center.z); validAim = true; return; } } status = (selected.wallOnly ? ("Aim at an inside wall to mount " + selected.id) : ("Aim at the cabin floor to place " + selected.id)); } private bool ValidPlacement(Movable m, LayoutEntry e) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.TransformPoint(e.position); Vector3 val2 = model.InverseTransformPoint(val); if (Mathf.Abs(val2.x) > 3.4f || val2.z < -7.6f || val2.z > 9f || val2.y < -0.6f || val2.y > 4.4f) { return false; } if (CoversWindow(m, val, ((Component)this).transform.rotation * Quaternion.Euler(e.rotation))) { return false; } if (!m.wallOnly) { return true; } Quaternion val3 = ((Component)this).transform.rotation * Quaternion.Euler(e.rotation); Vector3 val4 = val3 * Vector3.forward; if (Mathf.Abs(Vector3.Dot(val4, ((Component)this).transform.up)) > 0.35f) { return false; } RaycastHit[] array = Physics.RaycastAll(val + val4 * 0.12f, -val4, 0.6f, -1, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val5 = array[i]; if (((RaycastHit)(ref val5)).transform.IsChildOf(model) && ((Object)((RaycastHit)(ref val5)).transform).name.StartsWith("Structure_") && Mathf.Abs(Vector3.Dot(((RaycastHit)(ref val5)).normal, ((Component)this).transform.up)) < 0.4f) { return true; } } return false; } private void ConfirmSelection() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_0144: Unknown result type (might be due to invalid IL or missing references) if (selected == null) { return; } LayoutEntry layoutEntry = new LayoutEntry(); layoutEntry.id = selected.id; layoutEntry.position = ((Component)this).transform.InverseTransformPoint(selected.root.position); Quaternion val = Quaternion.Inverse(((Component)this).transform.rotation) * selected.root.rotation; layoutEntry.rotation = ((Quaternion)(ref val)).eulerAngles; LayoutEntry layoutEntry2 = layoutEntry; if (CoversWindow(selected, selected.root.position, selected.root.rotation)) { status = "Keep the side windows and skylight clear."; return; } if (!validAim || !ValidPlacement(selected, layoutEntry2)) { status = "Placement needs a " + (selected.wallOnly ? "wall behind the mounting plate." : "position inside the cabin."); return; } if (PlacementTouchesPlayer(selected)) { status = "Move the furnishing away from a player before placing it."; return; } ResumeAfterMove(selected); Plugin.Log.LogInfo((object)("MOVE COMMIT " + selected.id + " at " + layoutEntry2.position)); selected = null; editing = false; status = "Placement saved."; noticeUntil = Time.unscaledTime + 3f; if (!Object.op_Implicit((Object)(object)network) || network.IsServer) { SaveLayout(); Broadcast(); } else { SendEdit(layoutEntry2); } } private void CancelSelection() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (selected != null && Object.op_Implicit((Object)(object)selected.root)) { selected.root.localPosition = previousPosition; selected.root.localRotation = previousRotation; ResumeAfterMove(selected); } selected = null; editing = false; Physics.SyncTransforms(); } private void OnGUI() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!editing) { if (Time.unscaledTime < noticeUntil) { GUI.Box(new Rect(20f, 20f, 720f, 45f), status); } return; } GUI.Box(new Rect(15f, 15f, 820f, 150f), "UNSC furniture editor — B selects / places; F7 exits\n" + ((selected == null) ? "Aim and click to select. Tab cycles furniture. Backspace restores defaults (host)." : ("Aim at " + (selected.wallOnly ? "a wall" : "the floor") + "; B / Enter / click places; right-click cancels. R rotates floor furniture.")) + "\nLooking at: " + ((hovered != null) ? hovered.id : "no furnishing") + "\nSelected: " + ((selected != null) ? selected.id : "none") + "\n" + status); } private unsafe void SendEdit(LayoutEntry entry) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) byte[] bytes = Encoding.UTF8.GetBytes(LayoutCodec.Serialize(new LayoutFile { entries = new LayoutEntry[1] { entry } })); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(bytes.Length, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteBytesSafe(bytes, -1, 0); network.CustomMessagingManager.SendNamedMessage("clair.unscdropship.edit.v2", 0uL, val, (NetworkDelivery)4); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } private void ReceiveEdit(ulong sender, FastBufferReader reader) { //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_007b: Unknown result type (might be due to invalid IL or missing references) if (!network.IsServer || !network.ConnectedClientsIds.Contains(sender)) { return; } PlayerControllerB val = ((IEnumerable<PlayerControllerB>)round.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB p) => p.actualClientId == sender)); if (!Object.op_Implicit((Object)(object)val) || val.isPlayerDead) { return; } Vector3 val2 = model.InverseTransformPoint(((Component)val).transform.position); if (Mathf.Abs(val2.x) > 3.5f || val2.z < -8f || val2.z > 9f) { return; } try { int num = ((FastBufferReader)(ref reader)).Length - ((FastBufferReader)(ref reader)).Position; if (num >= 1 && num <= 4096) { byte[] bytes = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref bytes, num, 0); LayoutFile layoutFile = LayoutCodec.Deserialize(Encoding.UTF8.GetString(bytes)); if (layoutFile != null && layoutFile.version == 2 && layoutFile.entries != null && layoutFile.entries.Length == 1) { Apply(layoutFile); SaveLayout(); Broadcast(); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Rejected furniture edit: " + ex.Message)); } } private void Remember(Transform t) { //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (!originals.ContainsKey(t)) { originals.Add(t, new TransformState { parent = t.parent, position = t.localPosition, rotation = t.localRotation, scale = t.localScale }); } } private Vector3 P(float x, float y, float z) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return model.TransformPoint(new Vector3(x, y, z)); } internal void Initialize(StartOfRound r, string directory) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_0501: 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_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_08c9: Unknown result type (might be due to invalid IL or missing references) //IL_08dd: Unknown result type (might be due to invalid IL or missing references) //IL_0902: Unknown result type (might be due to invalid IL or missing references) //IL_0916: Unknown result type (might be due to invalid IL or missing references) //IL_093b: Unknown result type (might be due to invalid IL or missing references) //IL_094f: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Expected O, but got Unknown //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Expected O, but got Unknown //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_09c1: Unknown result type (might be due to invalid IL or missing references) //IL_09c6: Unknown result type (might be due to invalid IL or missing references) //IL_09cd: Unknown result type (might be due to invalid IL or missing references) //IL_09d2: Unknown result type (might be due to invalid IL or missing references) //IL_09f9: Unknown result type (might be due to invalid IL or missing references) //IL_085b: Unknown result type (might be due to invalid IL or missing references) //IL_0862: Expected O, but got Unknown //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_0ab3: Unknown result type (might be due to invalid IL or missing references) //IL_0afb: Unknown result type (might be due to invalid IL or missing references) //IL_0a54: Unknown result type (might be due to invalid IL or missing references) //IL_0b5b: Unknown result type (might be due to invalid IL or missing references) //IL_0d5c: Unknown result type (might be due to invalid IL or missing references) //IL_0d66: Expected O, but got Unknown //IL_0d7d: Unknown result type (might be due to invalid IL or missing references) //IL_0d87: Expected O, but got Unknown //IL_0d9e: Unknown result type (might be due to invalid IL or missing references) //IL_0da8: Expected O, but got Unknown round = r; Transform val = ((Component)this).transform.Find("ShipHull"); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((Component)val).GetComponent<MeshFilter>())) { throw new InvalidOperationException("Expected stock HangarShip/ShipHull is missing. Another ship mod or game update may be incompatible."); } Material sharedMaterial = ((Component)val).GetComponent<Renderer>().sharedMaterial; model = new GameObject("UNSC_Dropship_Replacement").transform; model.SetParent(((Component)this).transform, false); ((Component)model).gameObject.SetActive(false); using (FileStream stream = File.OpenRead(Path.Combine(directory, "dropship.bin.gz"))) { using GZipStream input = new GZipStream(stream, CompressionMode.Decompress); using BinaryReader binaryReader = new BinaryReader(input); if (Encoding.ASCII.GetString(binaryReader.ReadBytes(8)) != "UNSC0001") { throw new InvalidDataException("Bad mesh payload header"); } int num = binaryReader.ReadInt32(); scale = ReadVector(binaryReader); if (num < 1 || num > 256) { throw new InvalidDataException("Unexpected mesh count"); } Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Color val2 = default(Color); for (int i = 0; i < num; i++) { int num2 = binaryReader.ReadInt32(); if (num2 < 1 || num2 > 128) { throw new InvalidDataException("Invalid group name"); } string text = Encoding.UTF8.GetString(binaryReader.ReadBytes(num2)); bool flag = binaryReader.ReadBoolean(); ((Color)(ref val2))..ctor(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); int num3 = binaryReader.ReadInt32(); if (num3 < 3 || num3 > 2000000) { throw new InvalidDataException("Invalid vertex count"); } Vector3[] array = (Vector3[])(object)new Vector3[num3]; for (int j = 0; j < num3; j++) { ref Vector3 reference = ref array[j]; reference = ReadVector(binaryReader); } int num4 = binaryReader.ReadInt32(); if (num4 < 3 || num4 > 6000000 || num4 % 3 != 0) { throw new InvalidDataException("Invalid triangles"); } int[] array2 = new int[num4]; for (int k = 0; k < num4; k++) { array2[k] = binaryReader.ReadInt32(); if (array2[k] < 0 || array2[k] >= num3) { throw new InvalidDataException("Mesh index out of range"); } } if (!dictionary.TryGetValue(text, out var value)) { value = new GameObject(text).transform; value.SetParent(model, false); dictionary.Add(text, value); } GameObject val3 = new GameObject(text + "_Mesh" + i); val3.transform.SetParent(value, false); val3.layer = ((Component)val).gameObject.layer; Mesh val4 = new Mesh(); ((Object)val4).name = text; val4.indexFormat = (IndexFormat)1; val4.vertices = array; val4.triangles = array2; val4.RecalculateNormals(); val4.RecalculateBounds(); meshes.Add(val4); val3.AddComponent<MeshFilter>().sharedMesh = val4; Material val5 = new Material(sharedMaterial); ((Object)val5).name = "UNSC_" + text; materials.Add(val5); string[] array3 = new string[6] { "_BaseColorMap", "_BaseMap", "_MainTex", "_MaskMap", "_NormalMap", "_EmissiveColorMap" }; foreach (string text2 in array3) { if (val5.HasProperty(text2)) { val5.SetTexture(text2, (Texture)null); } } if (val5.HasProperty("_BaseColor")) { val5.SetColor("_BaseColor", val2); } if (val5.HasProperty("_Color")) { val5.SetColor("_Color", val2); } if (val5.HasProperty("_Metallic")) { val5.SetFloat("_Metallic", 0.15f); } if (val5.HasProperty("_Smoothness")) { val5.SetFloat("_Smoothness", 0.25f); } if (val5.HasProperty("_CullMode")) { val5.SetFloat("_CullMode", 0f); } if (val5.HasProperty("_CullModeForward")) { val5.SetFloat("_CullModeForward", 0f); } MeshRenderer val6 = val3.AddComponent<MeshRenderer>(); ((Renderer)val6).sharedMaterial = val5; if (text == "WindowGlass") { ((Renderer)val6).enabled = false; } if (flag) { val3.AddComponent<MeshCollider>().sharedMesh = val4; } } left = dictionary["DoorLeft"]; right = dictionary["DoorRight"]; model.localRotation = Quaternion.Euler(0f, 90f, 0f); model.localScale = scale; model.localPosition = new Vector3(-7.02f + 7.31f * scale.z, -0.5f * scale.y, -6.6742f); foreach (KeyValuePair<string, Transform> item in dictionary) { if (item.Key != "Structure" && item.Key != "WindowGlass" && !item.Key.StartsWith("Door")) { Register(item.Key, item.Value, centerPivot: true); } } } RemoveHorn(); BuildCommandConsole(); MoveStock("Terminal", "Terminal", new Vector3(-1.4f, 0.5f, -3.4f)); MoveStock("StorageCloset", "Storage locker", new Vector3(1.5f, 0.5f, -1.1f)); MountLightSwitch(); Transform val7 = ((Component)this).transform.Find("AnimatedShipDoor/HangarDoorButtonPanel"); if (Object.op_Implicit((Object)(object)val7)) { MakeWallFixture("Door buttons", val7, val7.TransformVector(Vector3.up), val7.TransformVector(Vector3.forward), new Vector3(-2.05f, 1.7f, -7.16f), Vector3.forward); } HashSet<string> hashSet = new HashSet<string>(new string[33] { "Terminal", "StorageCloset", "StartGameLever", "AnimatedShipDoor", "LightSwitchContainer", "ShipElectricLights", "RightmostSuitPlacement", "Cameras", "ShipCamera", "UNSC_Dropship_Replacement", "UNSC_CommandConsole", "UNSC_WallFixtures", "PositionNodes", "Nodes", "ShipInsidePositions", "ShipBoundsTrigger", "ShipInnerRoomBoundsTrigger", "ShipStrictInnerRoomBounds", "LandingShipNavObstacle", "ReverbTriggers", "FogExclusionZone", "KillTrigger", "damageTrigger", "OutOfBounds", "ThrusterAmbientAudio", "ShipLandingTurbulence", "ShipLandingTurbulenceScrap", "ShipDoorsCloseJingle", "HangarDoorAudioSource", "LampSqueakAudio", "WindParticle (1)", "ClipboardManual", "StickyNoteItem" }); Transform[] array4 = ((IEnumerable)((Component)this).transform).Cast<Transform>().ToArray(); foreach (Transform val8 in array4) { if (!hashSet.Contains(((Object)val8).name) && SceneCleanupPolicy.ShouldHideRoot(((Object)val8).name, (Object)(object)((Component)val8).GetComponentInChildren<PlayerControllerB>(true) != (Object)null, (Object)(object)((Component)val8).GetComponentInChildren<PlaceableShipObject>(true) != (Object)null, (Object)(object)((Component)val8).GetComponentInChildren<GrabbableObject>(true) != (Object)null)) { HideGeometry(val8); } } Transform val9 = ((Component)this).transform.Find("AnimatedShipDoor"); if (Object.op_Implicit((Object)(object)val9)) { foreach (Transform item2 in val9) { Transform val10 = item2; if ((Object)(object)val10 != (Object)(object)val7 && ((Object)val10).name != "OutsideDoorPoint") { HideGeometry(val10); } } } RemoveExteriorBarrier(); ResizeBounds(round.shipInnerRoomBounds, new Vector3(0f, 1.95f, -0.3f), new Vector3(5.6f, 2.9f, 13.7f)); ResizeBounds(round.shipStrictInnerRoomBounds, new Vector3(0f, 1.95f, -0.3f), new Vector3(5.3f, 2.8f, 13.2f)); ResizeBounds(round.shipBounds, new Vector3(0f, 2f, -0.1f), new Vector3(7f, 5f, 17f)); Transform val11 = ((Component)this).transform.Find("PlacementBlockers"); if (Object.op_Implicit((Object)(object)val11)) { HideGeometry(val11); } Transform val12 = ((Component)this).transform.Find("LandingShipNavObstacle"); if (Object.op_Implicit((Object)(object)val12)) { NavMeshObstacle component = ((Component)val12).GetComponent<NavMeshObstacle>(); if (Object.op_Implicit((Object)(object)component)) { component.center = ((Component)this).transform.InverseTransformPoint(P(0f, 2f, 0f)) - val12.localPosition; component.size = new Vector3(20f, 5f, 5.9f * scale.x); } } for (int n = 0; n < round.playerSpawnPositions.Length; n++) { Transform val13 = round.playerSpawnPositions[n]; if (Object.op_Implicit((Object)(object)val13)) { Remember(val13); val13.position = P((n % 2 == 0) ? (-0.55f) : 0.55f, 0.7f, -4.5f + (float)(n / 2) * 0.8f); } } if (Object.op_Implicit((Object)(object)round.middleOfShipNode)) { Remember(round.middleOfShipNode); round.middleOfShipNode.position = P(0f, 1.2f, 0f); } if (Object.op_Implicit((Object)(object)round.shipDoorNode)) { Remember(round.shipDoorNode); round.shipDoorNode.position = P(0f, 1.2f, -6.8f); } for (int num5 = 0; num5 < round.insideShipPositions.Length; num5++) { if (Object.op_Implicit((Object)(object)round.insideShipPositions[num5])) { Remember(round.insideShipPositions[num5]); round.insideShipPositions[num5].position = P(0f, 1f, -5f + (float)num5 * 0.8f); } } AddCabinLighting(); AddBoardingBridge(); ((Component)model).gameObject.SetActive(true); fraction = ((!round.hangarDoorsClosed) ? 1 : 0); PoseDoor(); PlaceableShipObject[] array5 = Object.FindObjectsOfType<PlaceableShipObject>(); foreach (PlaceableShipObject val14 in array5) { Transform t = (Object.op_Implicit((Object)(object)val14.parentObjectSecondary) ? val14.parentObjectSecondary : (Object.op_Implicit((Object)(object)val14.parentObject) ? ((Component)val14.parentObject).transform : ((Component)val14).transform)); if (!IsRemoved(t) && !movable.Values.Any((Movable movable) => (Object)(object)t == (Object)(object)movable.root || t.IsChildOf(movable.root)) && (t.IsChildOf(((Component)this).transform) || (Object)(object)val14.parentObject != (Object)null)) { Register("Stock_" + val14.unlockableID, t, centerPivot: false); } } MountTeleporterButtons(); RehomeFurniture(); foreach (Movable item3 in movable.Values.Where((Movable movable) => movable.wallOnly)) { SnapWallFixture(item3); } ConfigureSelection(); ClearDefaultWindowViews(); Physics.SyncTransforms(); initialized = true; network = NetworkManager.Singleton; if (Object.op_Implicit((Object)(object)network) && network.CustomMessagingManager != null) { network.CustomMessagingManager.RegisterNamedMessageHandler("clair.unscdropship.layout.v1", new HandleNamedMessageDelegate(ReceiveLayout)); network.CustomMessagingManager.RegisterNamedMessageHandler("clair.unscdropship.request.v1", new HandleNamedMessageDelegate(ReceiveRequest)); network.CustomMessagingManager.RegisterNamedMessageHandler("clair.unscdropship.edit.v2", new HandleNamedMessageDelegate(ReceiveEdit)); if (network.IsServer) { LoadLayout(); } else { SendRequest(); } } Plugin.Log.LogInfo((object)("REPLACEMENT READY: stock hull W/H/L=7.820944/7.700692/18.849890; target=18.770265/8.470761/24.504857 metres; mesh batches=" + meshes.Count + "; movable groups=" + movable.Count + ". Rear hatch slides laterally. Experimental test build.")); RepairMirroredColliders(); RestoreNativeFurniture(); ((MonoBehaviour)this).Invoke("RepairInitialSpawn", 1f); ValidateLeverAssembly(); LogPlayerBlockers(); Dump(); } private static Vector3 ReadVector(BinaryReader br) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle()); } private void HideGeometry(Transform t) { if (Object.op_Implicit((Object)(object)((Component)t).GetComponentInParent<PlayerControllerB>()) || Object.op_Implicit((Object)(object)((Component)t).GetComponentInChildren<PlayerControllerB>(true))) { return; } Renderer[] componentsInChildren = ((Component)t).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (val.enabled && !Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<PlayerControllerB>())) { hidden.Add(val); val.enabled = false; } } Collider[] componentsInChildren2 = ((Component)t).GetComponentsInChildren<Collider>(true); foreach (Collider val2 in componentsInChildren2) { if (SceneCleanupPolicy.CanDisableCollider(val2 is CharacterController, (Object)(object)((Component)val2).GetComponentInParent<PlayerControllerB>() != (Object)null, val2.isTrigger)) { if (!cleanupColliderStates.ContainsKey(val2)) { cleanupColliderStates.Add(val2, val2.enabled); } if (!disabled.Contains(val2)) { disabled.Add(val2); } val2.enabled = false; } } if (((Object)t).name == "Railing") { Plugin.Log.LogInfo((object)("Suppressed stock exterior railing colliders, including inactive landing barriers: " + ((Component)t).GetComponentsInChildren<Collider>(true).Length)); } } private void ProtectPlayerComponents() { for (int num = disabled.Count - 1; num >= 0; num--) { Collider val = disabled[num]; if (Object.op_Implicit((Object)(object)val) && (val is CharacterController || Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<PlayerControllerB>()))) { val.enabled = true; disabled.RemoveAt(num); Plugin.Log.LogWarning((object)("Restored player collider mistakenly queued for ship cleanup: " + ((Object)val).name)); } } for (int num2 = hidden.Count - 1; num2 >= 0; num2--) { Renderer val2 = hidden[num2]; if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Component)val2).GetComponentInParent<PlayerControllerB>())) { val2.enabled = true; hidden.RemoveAt(num2); } } } private void ResizeBounds(Collider c, Vector3 center, Vector3 size) { //IL_007a: 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_0096: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) BoxCollider val = (BoxCollider)(object)((c is BoxCollider) ? c : null); if (Object.op_Implicit((Object)(object)val)) { if (!boxOriginals.ContainsKey(val)) { boxOriginals.Add(val, (Vector3[])(object)new Vector3[2] { val.center, val.size }); } Remember(((Component)val).transform); ((Component)val).transform.SetParent(model, false); ((Component)val).transform.localPosition = center; ((Component)val).transform.localRotation = Quaternion.identity; ((Component)val).transform.localScale = Vector3.one; val.center = Vector3.zero; val.size = size; } } private void Register(string id, Transform t, bool centerPivot) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0099: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) if (movable.ContainsKey(id)) { return; } if (!t.IsChildOf(((Component)this).transform) && !Object.op_Implicit((Object)(object)((Component)t).GetComponentInParent<AutoParentToShip>())) { Remember(t); SetFixtureParent(t, ((Component)this).transform); } if (centerPivot) { Transform transform = new GameObject("Move_" + id).transform; transform.SetParent(((Component)this).transform, false); transform.rotation = ((Component)this).transform.rotation; Bounds val = BoundsOf(t); transform.position = new Vector3(((Bounds)(ref val)).center.x, ((Bounds)(ref val)).min.y, ((Bounds)(ref val)).center.z); t.SetParent(transform, true); t = transform; } AutoParentToShip[] componentsInChildren = ((Component)t).GetComponentsInChildren<AutoParentToShip>(true); foreach (AutoParentToShip val2 in componentsInChildren) { if (!parents.ContainsKey(val2)) { parents.Add(val2, ((Behaviour)val2).enabled); } ((Behaviour)val2).enabled = false; } movable.Add(id, new Movable { id = id, root = t, initial = t.localPosition, rotation = t.localRotation }); } private Bounds BoundsOf(Transform t) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return GeometryBounds(t, null); } private Bounds GeometryBounds(Transform t, Transform relative) { //IL_0014: 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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0092: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00f6: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) Bounds result = default(Bounds); ((Bounds)(ref result))..ctor(Object.op_Implicit((Object)(object)relative) ? relative.InverseTransformPoint(t.position) : t.position, Vector3.zero); bool flag = true; MeshFilter[] componentsInChildren = ((Component)t).GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val in componentsInChildren) { Renderer component = ((Component)val).GetComponent<Renderer>(); if (!Object.op_Implicit((Object)(object)component) || !component.enabled || !Object.op_Implicit((Object)(object)val.sharedMesh)) { continue; } Bounds bounds = val.sharedMesh.bounds; for (int j = 0; j < 8; j++) { Vector3 val2 = ((Component)val).transform.TransformPoint(((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1))))); if (Object.op_Implicit((Object)(object)relative)) { val2 = relative.InverseTransformPoint(val2); } if (flag) { result = new Bounds(val2, Vector3.zero); flag = false; } else { ((Bounds)(ref result)).Encapsulate(val2); } } } return result; } private void MoveStock(string path, string id, Vector3 position) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)this).transform.Find(path); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)("Missing stock fixture: " + path)); return; } Remember(val); val.position = model.TransformPoint(position); Bounds val2 = BoundsOf(val); val.position += Vector3.up * (model.TransformPoint(position).y - ((Bounds)(ref val2)).min.y); Register(id, val, centerPivot: false); } private void BuildCommandConsole() { //IL_000b: 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_00cf: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_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_016f: Unknown result type (might be due to invalid IL or missing references) CreateQuotaMonitor(); Transform transform = new GameObject("UNSC_CommandConsole").transform; transform.SetParent(((Component)this).transform, false); transform.localPosition = new Vector3(8.8f, 0f, -6.7f); string[] array = new string[5] { "ControlDesk", "ControlDesk.001", "ControlPanelWTexture", "StartGameLever", "ShipModels2b/MonitorWall" }; string[] array2 = array; foreach (string text in array2) { Transform val = ((Component)this).transform.Find(text); if (Object.op_Implicit((Object)(object)val)) { Remember(val); SetFixtureParent(val, transform); } else { Plugin.Log.LogWarning((object)("Console fixture missing: " + text)); } } Bounds val2 = BoundsOf(transform); float num = Mathf.Min(1f, 5.08f * scale.x / Mathf.Max(0.1f, ((Bounds)(ref val2)).size.z)); transform.localScale = Vector3.one * num; val2 = BoundsOf(transform); transform.position += P(0f, 0.5f, 3.1f) - new Vector3(((Bounds)(ref val2)).center.x, ((Bounds)(ref val2)).min.y, ((Bounds)(ref val2)).center.z); Register("Command console + monitors + launch lever", transform, centerPivot: false); } private void RehomeFurniture() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be