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 VRSAutomation v0.7.3
VRSAutomation.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; using VRSAutomation; using Valheim.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public static class Sounds { private class SoundHost : MonoBehaviour { } private const string SnapFile = "Pipe_Snap_Point.ogg"; private const string UndoFile = "Pipe_Snap_Point_Undo.ogg"; private const string InputFile = "Pipe_Input_Connection.ogg"; private const string OutputFile = "Pipe_Output_Connection.ogg"; private const string DisconnectFile = "Disconnect_Pipe_Socket.ogg"; private const string PlaceFile = "Conveyor_Combiner_Splitter_Placement_Sound.ogg"; private const float SnapVolume = 0.3f; private const float UndoVolume = 0.3f; private const float InputVolume = 0.19f; private const float OutputVolume = 0.22f; private const float DisconnectVolume = 0.25f; private const float PlaceVolume = 0.45f; private const float PitchMin = 0.92f; private const float PitchMax = 1.08f; private const float VolumeVariance = 0.05f; private const float MinDistance = 1f; private const float MaxDistance = 5f; private static readonly ManualLogSource Log = Logger.CreateLogSource("VRSSounds"); private static readonly Dictionary<string, object> Clips = new Dictionary<string, object>(); private static readonly Random Rng = new Random(); private static Type audioSourceType; private static Type audioTypeEnum; private static Type requestType; private static Type handlerType; private static GameObject host; private static bool started; private static Type Find(string fullName, string assembly) { return Type.GetType(fullName + ", " + assembly, throwOnError: false) ?? AccessTools.TypeByName(fullName); } public static void Start() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown if (!started || !((Object)(object)host != (Object)null)) { started = true; audioSourceType = Find("UnityEngine.AudioSource", "UnityEngine.AudioModule"); audioTypeEnum = Find("UnityEngine.AudioType", "UnityEngine.AudioModule"); requestType = Find("UnityEngine.Networking.UnityWebRequestMultimedia", "UnityEngine.UnityWebRequestAudioModule"); handlerType = Find("UnityEngine.Networking.DownloadHandlerAudioClip", "UnityEngine.UnityWebRequestAudioModule"); if (audioSourceType == null || audioTypeEnum == null || requestType == null || handlerType == null) { Log.LogWarning((object)"Audio classes not found, sounds disabled"); return; } host = new GameObject("VRSAutomation_Sounds"); Object.DontDestroyOnLoad((Object)(object)host); SoundHost h = host.AddComponent<SoundHost>(); string dir = Plugin.AssetDirectory(); Ensure(h, dir, "Pipe_Snap_Point.ogg"); Ensure(h, dir, "Pipe_Snap_Point_Undo.ogg"); Ensure(h, dir, "Pipe_Input_Connection.ogg"); Ensure(h, dir, "Pipe_Output_Connection.ogg"); Ensure(h, dir, "Disconnect_Pipe_Socket.ogg"); Ensure(h, dir, "Conveyor_Combiner_Splitter_Placement_Sound.ogg"); } } private static void Ensure(SoundHost h, string dir, string file) { if (!Clips.ContainsKey(file)) { string text = Assets.FilePath(file); if (text == null || !File.Exists(text)) { Log.LogWarning((object)("Sound file missing: " + file)); } else { ((MonoBehaviour)h).StartCoroutine(Load(file, text)); } } } private static IEnumerator Load(string file, string path) { string absoluteUri = new Uri(path).AbsoluteUri; object obj = Enum.Parse(audioTypeEnum, "OGGVORBIS"); MethodInfo method = requestType.GetMethod("GetAudioClip", new Type[2] { typeof(string), audioTypeEnum }); if (method == null) { Log.LogWarning((object)"GetAudioClip not found"); yield break; } object request = method.Invoke(null, new object[2] { absoluteUri, obj }); MethodInfo method2 = request.GetType().GetMethod("SendWebRequest", Type.EmptyTypes); object op = method2.Invoke(request, null); PropertyInfo isDone = op.GetType().GetProperty("isDone"); while (!(bool)isDone.GetValue(op, null)) { yield return null; } MethodInfo method3 = handlerType.GetMethod("GetContent", new Type[1] { request.GetType() }); object obj2 = ((method3 != null) ? method3.Invoke(null, new object[1] { request }) : null); if (obj2 == null) { Log.LogWarning((object)("Failed to load " + file)); yield break; } Clips[file] = obj2; Log.LogInfo((object)("Loaded sound " + file)); if (request is IDisposable disposable) { disposable.Dispose(); } } private static void Set(object target, string name, object value) { PropertyInfo property = target.GetType().GetProperty(name); if (property == null || !property.CanWrite) { return; } try { if (value is int && property.PropertyType.IsEnum) { value = Enum.ToObject(property.PropertyType, (int)value); } property.SetValue(target, value, null); } catch { } } private static float Between(float min, float max) { return min + (float)Rng.NextDouble() * (max - min); } private static void Play(string file, Vector3 position, float volume, bool vary) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown if (!(audioSourceType == null) && Clips.TryGetValue(file, out var value) && value != null) { float num = 1f; if (vary) { num = Between(0.92f, 1.08f); volume *= Between(0.95f, 1.05f); } GameObject val = new GameObject("VRS_Sound"); val.transform.position = position; Component val2 = val.AddComponent(audioSourceType); Set(val2, "clip", value); Set(val2, "volume", volume); Set(val2, "pitch", num); Set(val2, "spatialBlend", 1f); Set(val2, "rolloffMode", 1); Set(val2, "minDistance", 1f); Set(val2, "maxDistance", 5f); Set(val2, "dopplerLevel", 0f); Set(val2, "reverbZoneMix", 0f); Set(val2, "playOnAwake", false); MethodInfo method = audioSourceType.GetMethod("Play", Type.EmptyTypes); if (method != null) { method.Invoke(val2, null); } float num2 = 1f; PropertyInfo property = value.GetType().GetProperty("length"); if (property != null) { num2 = (float)property.GetValue(value, null); } Object.Destroy((Object)val, num2 / Mathf.Max(0.1f, num) + 0.5f); } } public static void Snap(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play("Pipe_Snap_Point.ogg", position, 0.3f, vary: true); } public static void Undo(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play("Pipe_Snap_Point_Undo.ogg", position, 0.3f, vary: true); } public static void Input(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play("Pipe_Input_Connection.ogg", position, 0.19f, vary: false); } public static void Output(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play("Pipe_Output_Connection.ogg", position, 0.22f, vary: false); } public static void Disconnect(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play("Disconnect_Pipe_Socket.ogg", position, 0.25f, vary: false); } public static void Place(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play("Conveyor_Combiner_Splitter_Placement_Sound.ogg", position, 0.45f, vary: true); } } [HarmonyPatch(typeof(Player), "Awake")] internal static class SoundAwakePatch { internal static void Postfix() { Sounds.Start(); } } namespace VRSAutomation { internal class Conveyor : MonoBehaviour { internal const string PieceName = "VRS_Conveyor"; internal const string SplitterName = "VRS_Splitter"; internal const string CombinerName = "VRS_Combiner"; internal const string AdapterDualName = "VRS_AdapterDual"; internal const string AdapterInName = "VRS_AdapterIn"; internal const string AdapterOutName = "VRS_AdapterOut"; internal const float JunctionAxis = 0.075f; internal const float JunctionBackZ = -0.13f; internal const float JunctionFrontZ = 0.2f; internal const float JunctionBarrelX = 0.16f; internal static bool IsJunction(string name) { if (!name.StartsWith("VRS_Splitter")) { return name.StartsWith("VRS_Combiner"); } return true; } internal static bool IsAdapter(string name) { if (!name.StartsWith("VRS_AdapterDual") && !name.StartsWith("VRS_AdapterIn")) { return name.StartsWith("VRS_AdapterOut"); } return true; } internal static void Register(ConfigFile config, Sprite icon) { //IL_0074: 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_00b8: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0184: 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) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) UvPack.Begin("conveyor"); Mesh mesh = BuildMesh(); UvPack.Finish(); UvPack.Begin("junction"); Mesh mesh2 = BuildJunctionMesh(); UvPack.Finish(); UvPack.Begin("adapter"); Mesh mesh3 = BuildAdapterMesh(0); Mesh mesh4 = BuildAdapterMesh(1); Mesh mesh5 = BuildAdapterMesh(-1); UvPack.Finish(); RegisterPiece(config, "VRS_Conveyor", "Conveyor", "Moves items from the box or machine on its input pipe to the one on its output pipe.", "Bronze:2,Wood:2", mesh, new Vector3(0.32f, 0.27f, 0.46f), new Vector3(0f, 0.135f, 0f), icon); RegisterPiece(config, "VRS_Splitter", "Splitter", "Shares a conveyor's items between up to three outputs.", "Bronze:3,Wood:3", mesh2, new Vector3(0.46f, 0.19f, 0.36f), new Vector3(0f, 0.09f, 0.035f), icon); RegisterPiece(config, "VRS_Combiner", "Combiner", "Brings up to three inputs together into one output for a conveyor.", "Bronze:3,Wood:3", mesh2, new Vector3(0.46f, 0.19f, 0.36f), new Vector3(0f, 0.09f, 0.035f), icon); RegisterPiece(config, "VRS_AdapterDual", "Storage adapter", "Bolts onto a box so pipes can connect to it: one input and one output.", "Bronze:1,Wood:1", mesh3, new Vector3(0.34f, 0.24f, 0.26f), new Vector3(0f, 0.12f, 0f), icon); RegisterPiece(config, "VRS_AdapterIn", "Input adapter", "Bolts onto a machine so a pipe can bring items in.", "Bronze:1,Wood:1", mesh4, new Vector3(0.28f, 0.17f, 0.17f), new Vector3(0.0375f, 0.085f, 0f), icon); RegisterPiece(config, "VRS_AdapterOut", "Output adapter", "Bolts onto a machine so a pipe can take items out.", "Bronze:1,Wood:1", mesh5, new Vector3(0.28f, 0.17f, 0.17f), new Vector3(-0.0375f, 0.085f, 0f), icon); } private static Mesh BuildAdapterMesh(int side) { //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0142: 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_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Expected O, but got Unknown //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Expected O, but got Unknown List<Vector3> list = new List<Vector3>(); List<Vector2> uv = new List<Vector2>(); List<int> list2 = new List<int>(); if (side == 0) { UvPack.Tag = "dual base plate"; AddBox(list, uv, list2, new Vector3(0f, 0.01f, 0f), new Vector3(0.3f, 0.02f, 0.24f)); UvPack.Tag = "dual bolts"; float[] array = new float[2] { -0.125f, 0.125f }; float[] array2 = new float[2] { -0.095f, 0.095f }; float[] array3 = array; foreach (float num in array3) { float[] array4 = array2; foreach (float num2 in array4) { AddCylinder(list, uv, list2, new Vector3(num, 0.026f, num2), Vector3.up, 0.012f, 0.012f, 6); } } UvPack.Tag = "dual body"; AddBox(list, uv, list2, new Vector3(0f, 0.105f, 0f), new Vector3(0.2f, 0.17f, 0.18f)); UvPack.Tag = "dual front panel frame"; AddBox(list, uv, list2, new Vector3(0f, 0.105f, 0.095f), new Vector3(0.15f, 0.12f, 0.01f)); UvPack.Tag = "dual grill slats"; for (int k = 0; k < 7; k++) { AddBox(list, uv, list2, new Vector3(0f, 0.058f + (float)k * 0.0155f, 0.103f), new Vector3(0.13f, 0.008f, 0.008f)); } UvPack.Tag = "dual ports"; array3 = new float[2] { -1f, 1f }; foreach (float num3 in array3) { AddCylinder(list, uv, list2, new Vector3(num3 * 0.1075f, 0.105f, 0f), new Vector3(num3, 0f, 0f), 0.075f, 0.015f, 18); AddCylinder(list, uv, list2, new Vector3(num3 * 0.13f, 0.105f, 0f), new Vector3(num3, 0f, 0f), 0.058f, 0.06f, 16); } } else { float num4 = side; UvPack.Tag = "single base plate"; AddBox(list, uv, list2, new Vector3(0f, 0.01f, 0f), new Vector3(0.16f, 0.02f, 0.16f)); UvPack.Tag = "single bolts"; float[] array5 = new float[2] { -0.062f, 0.062f }; float[] array3 = array5; foreach (float num5 in array3) { float[] array4 = array5; foreach (float num6 in array4) { AddCylinder(list, uv, list2, new Vector3(num5, 0.025f, num6), Vector3.up, 0.01f, 0.01f, 6); } } UvPack.Tag = "single body"; AddBox(list, uv, list2, new Vector3(0f, 0.08f, 0f), new Vector3(0.12f, 0.12f, 0.12f)); UvPack.Tag = "single panel frame"; AddBox(list, uv, list2, new Vector3(0f, 0.08f, 0.063f), new Vector3(0.09f, 0.09f, 0.006f)); UvPack.Tag = "single grill slats"; for (int l = 0; l < 5; l++) { AddBox(list, uv, list2, new Vector3(0f, 0.052f + (float)l * 0.0145f, 0.068f), new Vector3(0.08f, 0.007f, 0.006f)); } UvPack.Tag = "single port"; AddCylinder(list, uv, list2, new Vector3(num4 * 0.0675f, 0.08f, 0f), new Vector3(num4, 0f, 0f), 0.07f, 0.015f, 16); AddCylinder(list, uv, list2, new Vector3(num4 * 0.105f, 0.08f, 0f), new Vector3(num4, 0f, 0f), 0.058f, 0.06f, 16); } Mesh val = new Mesh { name = ((side == 0) ? "VRS_AdapterDual" : ((side > 0) ? "VRS_AdapterIn" : "VRS_AdapterOut")) }; val.SetVertices(list); UvPack.Track(val, uv, list2); val.SetTriangles(list2, 0); val.RecalculateNormals(); val.RecalculateBounds(); return val; } private static string IconFile(string name) { return name switch { "VRS_Conveyor" => "VRS_icon_conveyor.png", "VRS_Splitter" => "VRS_icon_splitter.png", "VRS_Combiner" => "VRS_icon_combiner.png", "VRS_AdapterDual" => "VRS_icon_adapter_dual.png", "VRS_AdapterOut" => "VRS_icon_adapter_out.png", "VRS_AdapterIn" => "VRS_icon_adapter_in.png", _ => null, }; } private static Sprite LoadIcon(string name) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) string text = IconFile(name); byte[] array = ((text != null) ? Assets.ReadBytes(text) : null); if (array == null) { return null; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!PipeTool.TryLoadPng(val, array)) { return null; } ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } private static void RegisterPiece(ConfigFile config, string name, string title, string description, string defaultCost, Mesh mesh, Vector3 colliderSize, Vector3 colliderCenter, Sprite icon) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) ConfigEntry<string> obj = Costs.Bind(name, title, defaultCost, "build a " + title.ToLower()); PieceConfig val = new PieceConfig(); val.Name = title; val.Description = description; val.PieceTable = PieceTables.Hammer; val.Category = "Automation"; Sprite val2 = LoadIcon(name); val.Icon = (((Object)(object)val2 != (Object)null) ? val2 : (((Object)(object)icon != (Object)null) ? icon : FallbackIcon())); foreach (KeyValuePair<string, int> item in Costs.Parse(obj.Value, defaultCost)) { val.AddRequirement(new RequirementConfig(item.Key, item.Value, 0, true)); } CustomPiece val3 = new CustomPiece(name, true, val); GameObject piecePrefab = val3.PiecePrefab; int layer = (piecePrefab.layer = LayerMask.NameToLayer("piece_nonsolid")); MeshRenderer[] componentsInChildren = piecePrefab.GetComponentsInChildren<MeshRenderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } MeshFilter[] componentsInChildren2 = piecePrefab.GetComponentsInChildren<MeshFilter>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } Collider[] componentsInChildren3 = piecePrefab.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren3[i]); } ZNetView component = piecePrefab.GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null) { component.m_persistent = true; } GameObject val4 = new GameObject("model") { layer = layer }; val4.transform.SetParent(piecePrefab.transform, false); val4.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer val5 = val4.AddComponent<MeshRenderer>(); Shader val6 = Shader.Find("Standard"); if ((Object)(object)val6 == (Object)null) { val6 = Shader.Find("Sprites/Default"); } if ((Object)(object)val6 == (Object)null) { val6 = Shader.Find("Legacy Shaders/Diffuse"); } if ((Object)(object)val6 != (Object)null) { Material val7 = new Material(val6); val7.color = new Color(0.35f, 0.33f, 0.3f); ((Renderer)val5).sharedMaterial = val7; } BoxCollider obj2 = piecePrefab.AddComponent<BoxCollider>(); obj2.size = colliderSize; obj2.center = colliderCenter; piecePrefab.AddComponent<Conveyor>(); if (IsJunction(name)) { piecePrefab.AddComponent<JunctionHover>(); } if (IsAdapter(name)) { piecePrefab.AddComponent<AdapterHost>(); } if (name == "VRS_Conveyor") { piecePrefab.AddComponent<ConveyorInteract>(); } PieceManager.Instance.AddPiece(val3); } private static Sprite FallbackIcon() { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(8, 8, (TextureFormat)4, false); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.35f, 0.33f, 0.3f, 1f); for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { val.SetPixel(i, j, val2); } } val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 8f, 8f), new Vector2(0.5f, 0.5f)); } private void Awake() { if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated()) { return; } MeshRenderer componentInChildren = ((Component)this).GetComponentInChildren<MeshRenderer>(); if ((Object)(object)componentInChildren != (Object)null) { Material val = PieceTextures.For(((Object)((Component)this).gameObject).name); if ((Object)(object)val != (Object)null) { ((Renderer)componentInChildren).sharedMaterial = val; } } if (((Object)((Component)this).gameObject).name.StartsWith("VRS_Conveyor") && (Object)(object)((Component)this).GetComponent<ConveyorLight>() == (Object)null) { ((Component)this).gameObject.AddComponent<ConveyorLight>(); } if (((Object)((Component)this).gameObject).name.StartsWith("VRS_AdapterDual") && (Object)(object)((Component)this).GetComponent<AdapterScreen>() == (Object)null) { ((Component)this).gameObject.AddComponent<AdapterScreen>(); } if ((((Object)((Component)this).gameObject).name.StartsWith("VRS_Conveyor") || IsJunction(((Object)((Component)this).gameObject).name)) && (Object)(object)((Component)this).GetComponent<MountFeet>() == (Object)null) { ((Component)this).gameObject.AddComponent<MountFeet>(); } } private static Mesh BuildMesh() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Expected O, but got Unknown //IL_014e: 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) List<Vector3> list = new List<Vector3>(); List<Vector2> uv = new List<Vector2>(); List<int> list2 = new List<int>(); UvPack.Tag = "conveyor body"; AddBox(list, uv, list2, new Vector3(0f, 0.085f, 0f), new Vector3(0.3f, 0.17f, 0.34f)); UvPack.Tag = "conveyor top step"; AddBox(list, uv, list2, new Vector3(0f, 0.205f, 0f), new Vector3(0.24f, 0.07f, 0.28f)); UvPack.Tag = "conveyor collars"; AddCylinder(list, uv, list2, new Vector3(0f, 0.1f, 0.176f), Vector3.forward, 0.108f, 0.012f, 16); AddCylinder(list, uv, list2, new Vector3(0f, 0.1f, -0.176f), Vector3.back, 0.108f, 0.012f, 16); UvPack.Tag = "conveyor bolts"; float[] array = new float[2] { -0.085f, 0.085f }; float[] array2 = new float[2] { -0.105f, 0.105f }; float[] array3 = array; foreach (float num in array3) { float[] array4 = array2; foreach (float num2 in array4) { AddCylinder(list, uv, list2, new Vector3(num, 0.246f, num2), Vector3.up, 0.014f, 0.012f, 6); } } UvPack.Tag = "conveyor arrow"; AddBox(list, uv, list2, new Vector3(0f, 0.245f, -0.03f), new Vector3(0.03f, 0.01f, 0.1f)); AddPrism(list, uv, list2, new Vector3(0f, 0.24f, 0.02f), 0.05f, 0.07f, 0.01f); Mesh val = new Mesh { name = "VRS_Conveyor" }; val.SetVertices(list); UvPack.Track(val, uv, list2); val.SetTriangles(list2, 0); val.RecalculateNormals(); val.RecalculateBounds(); return val; } private static Mesh BuildJunctionMesh() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown List<Vector3> list = new List<Vector3>(); List<Vector2> uv = new List<Vector2>(); List<int> list2 = new List<int>(); float num = 0.075f; UvPack.Tag = "junction body"; AddCylinder(list, uv, list2, new Vector3(0f, num, -0.025f), Vector3.forward, 0.075f, 0.15f, 20); AddCylinder(list, uv, list2, new Vector3(0f, num, -0.08f), Vector3.forward, 0.083f, 0.016f, 20); AddCylinder(list, uv, list2, new Vector3(0f, num, -0.114999995f), Vector3.back, 0.05f, 0.03f, 14); UvPack.Tag = "junction ribs"; float[] array = new float[3] { -0.025f, 0f, 0.025f }; foreach (float num2 in array) { AddBox(list, uv, list2, new Vector3(num2, num + 0.079f, -0.03f), new Vector3(0.012f, 0.01f, 0.05f)); } UvPack.Tag = "junction bent pipes"; AddElbow(list, uv, list2, -1f, num); AddElbow(list, uv, list2, 1f, num); UvPack.Tag = "junction barrels"; array = new float[3] { -0.16f, 0f, 0.16f }; foreach (float num3 in array) { AddCylinder(list, uv, list2, new Vector3(num3, num, 0.11f), Vector3.forward, 0.068f, 0.12f, 18); AddCylinder(list, uv, list2, new Vector3(num3, num, 0.08f), Vector3.forward, 0.074f, 0.012f, 18); AddCylinder(list, uv, list2, new Vector3(num3, num, 0.185f), Vector3.forward, 0.05f, 0.03f, 14); } Mesh val = new Mesh { name = "VRS_Junction" }; val.SetVertices(list); UvPack.Track(val, uv, list2); val.SetTriangles(list2, 0); val.RecalculateNormals(); val.RecalculateBounds(); return val; } private static void AddElbow(List<Vector3> v, List<Vector2> uv, List<int> t, float side, float axisY) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a0: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00d4: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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) float num = 0.16f; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(side * 0.07f, axisY, -0.06f); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(side * (num - 0.09f), axisY, -0.06f); Vector3 val3 = val2 - val; if (((Vector3)(ref val3)).magnitude > 0.001f) { Vector3 center = (val + val2) * 0.5f; val3 = val2 - val; Vector3 normalized = ((Vector3)(ref val3)).normalized; val3 = val2 - val; AddCylinder(v, uv, t, center, normalized, 0.05f, ((Vector3)(ref val3)).magnitude, 10); } Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(side * (num - 0.09f), axisY, 0.030000005f); Vector3 p = val2; Vector3 t2 = default(Vector3); ((Vector3)(ref t2))..ctor(side, 0f, 0f); Vector3 val6 = default(Vector3); for (int i = 1; i <= 8; i++) { float num2 = (float)i / 8f * (float)Math.PI * 0.5f; Vector3 val5 = val4 + 0.09f * new Vector3(side * Mathf.Sin(num2), 0f, 0f - Mathf.Cos(num2)); ((Vector3)(ref val6))..ctor(side * Mathf.Cos(num2), 0f, Mathf.Sin(num2)); AddBendSegment(v, uv, t, p, t2, val5, val6, 0.05f, 10); p = val5; t2 = val6; } Vector3 val7 = default(Vector3); ((Vector3)(ref val7))..ctor(side * num, axisY, 0.030000005f); Vector3 val8 = default(Vector3); ((Vector3)(ref val8))..ctor(side * num, axisY, 0.06f); Vector3 center2 = (val7 + val8) * 0.5f; val3 = val8 - val7; Vector3 normalized2 = ((Vector3)(ref val3)).normalized; val3 = val8 - val7; AddCylinder(v, uv, t, center2, normalized2, 0.05f, ((Vector3)(ref val3)).magnitude, 10); } private static void AddBendSegment(List<Vector3> v, List<Vector2> uv, List<int> t, Vector3 p0, Vector3 t0, Vector3 p1, Vector3 t1, float radius, int segments) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00e7: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Cross(t0, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; val = Vector3.Cross(t1, Vector3.up); Vector3 normalized2 = ((Vector3)(ref val)).normalized; float num = (float)Math.PI * 2f * radius; float num2 = Vector3.Distance(p0, p1); int count = v.Count; for (int i = 0; i < segments; i++) { float num3 = (float)i / (float)segments * (float)Math.PI * 2f; float num4 = (float)(i + 1) / (float)segments * (float)Math.PI * 2f; Vector3 val2 = Vector3.up * Mathf.Cos(num3) + normalized * Mathf.Sin(num3); Vector3 val3 = Vector3.up * Mathf.Cos(num4) + normalized * Mathf.Sin(num4); Vector3 val4 = Vector3.up * Mathf.Cos(num3) + normalized2 * Mathf.Sin(num3); Vector3 val5 = Vector3.up * Mathf.Cos(num4) + normalized2 * Mathf.Sin(num4); AddQuadUv(v, uv, t, p0 + val2 * radius, p0 + val3 * radius, p1 + val5 * radius, p1 + val4 * radius, val2 + val3 + val4 + val5, new Vector2((float)i / (float)segments * num, 0f), new Vector2((float)(i + 1) / (float)segments * num, 0f), new Vector2((float)(i + 1) / (float)segments * num, num2), new Vector2((float)i / (float)segments * num, num2)); } UvPack.Add(count, v.Count - count); } private static void AddQuadUv(List<Vector3> v, List<Vector2> uv, List<int> t, Vector3 a, Vector3 b, Vector3 c, Vector3 d, Vector3 outward, Vector2 ua, Vector2 ub, Vector2 uc, Vector2 ud) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001f: 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_002f: 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_003f: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_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_005b: Unknown result type (might be due to invalid IL or missing references) int count = v.Count; v.Add(a); v.Add(b); v.Add(c); v.Add(d); uv.Add(ua); uv.Add(ub); uv.Add(uc); uv.Add(ud); if (Vector3.Dot(Vector3.Cross(b - a, c - a), outward) >= 0f) { t.AddRange(new int[6] { count, count + 1, count + 2, count, count + 2, count + 3 }); } else { t.AddRange(new int[6] { count, count + 2, count + 1, count, count + 3, count + 2 }); } } private static void AddQuad(List<Vector3> v, List<Vector2> uv, List<int> t, Vector3 a, Vector3 b, Vector3 c, Vector3 d, Vector3 outward) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_0010: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_001b: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0042: 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_0046: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_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_008d: 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_0099: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = d - a; val = val2 - normalized * Vector3.Dot(val2, normalized); val2 = ((Vector3)(ref val)).normalized; int count = v.Count; AddQuadUv(v, uv, t, a, b, c, d, outward, Vector2.zero, new Vector2(Vector3.Dot(b - a, normalized), 0f), new Vector2(Vector3.Dot(c - a, normalized), Vector3.Dot(c - a, val2)), new Vector2(0f, Vector3.Dot(d - a, val2))); UvPack.Add(count, 4); } private static void AddTriangleUv(List<Vector3> v, List<Vector2> uv, List<int> t, Vector3 a, Vector3 b, Vector3 c, Vector3 outward, Vector2 ua, Vector2 ub, Vector2 uc) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001f: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_003e: 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_0041: 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) int count = v.Count; v.Add(a); v.Add(b); v.Add(c); uv.Add(ua); uv.Add(ub); uv.Add(uc); if (Vector3.Dot(Vector3.Cross(b - a, c - a), outward) >= 0f) { t.AddRange(new int[3] { count, count + 1, count + 2 }); } else { t.AddRange(new int[3] { count, count + 2, count + 1 }); } } private static void AddTriangle(List<Vector3> v, List<Vector2> uv, List<int> t, Vector3 a, Vector3 b, Vector3 c, Vector3 outward) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_0010: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_001b: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0042: 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_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0071: 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_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_007f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = c - a; val = val2 - normalized * Vector3.Dot(val2, normalized); val2 = ((Vector3)(ref val)).normalized; int count = v.Count; AddTriangleUv(v, uv, t, a, b, c, outward, Vector2.zero, new Vector2(Vector3.Dot(b - a, normalized), 0f), new Vector2(Vector3.Dot(c - a, normalized), Vector3.Dot(c - a, val2))); UvPack.Add(count, 3); } private static void AddBox(List<Vector3> v, List<Vector2> uv, List<int> t, Vector3 center, Vector3 size) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //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_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00ae: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d5: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023a: 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_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_024d: 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_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = size * 0.5f; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, 0f); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(0f, val.y, 0f); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(0f, 0f, val.z); AddQuad(v, uv, t, center + val2 - val3 - val4, center + val2 + val3 - val4, center + val2 + val3 + val4, center + val2 - val3 + val4, Vector3.right); AddQuad(v, uv, t, center - val2 - val3 - val4, center - val2 + val3 - val4, center - val2 + val3 + val4, center - val2 - val3 + val4, Vector3.left); AddQuad(v, uv, t, center - val2 + val3 - val4, center + val2 + val3 - val4, center + val2 + val3 + val4, center - val2 + val3 + val4, Vector3.up); AddQuad(v, uv, t, center - val2 - val3 - val4, center + val2 - val3 - val4, center + val2 - val3 + val4, center - val2 - val3 + val4, Vector3.down); AddQuad(v, uv, t, center - val2 - val3 + val4, center + val2 - val3 + val4, center + val2 + val3 + val4, center - val2 + val3 + val4, Vector3.forward); AddQuad(v, uv, t, center - val2 - val3 - val4, center + val2 - val3 - val4, center + val2 + val3 - val4, center - val2 + val3 - val4, Vector3.back); } private static void AddCylinder(List<Vector3> v, List<Vector2> uv, List<int> t, Vector3 center, Vector3 axis, float radius, float length, int segments) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00d1: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Mathf.Abs(Vector3.Dot(axis, Vector3.up)) > 0.9f) ? Vector3.right : Vector3.up); Vector3 val2 = Vector3.Cross(axis, val); val = ((Vector3)(ref val2)).normalized; Vector3 val3 = Vector3.Cross(axis, val); Vector3 val4 = center - axis * (length * 0.5f); Vector3 val5 = center + axis * (length * 0.5f); float num = (float)Math.PI * 2f * radius; int count = v.Count; for (int i = 0; i < segments; i++) { float num2 = (float)i / (float)segments * (float)Math.PI * 2f; float num3 = (float)(i + 1) / (float)segments * (float)Math.PI * 2f; Vector3 val6 = val * Mathf.Cos(num2) + val3 * Mathf.Sin(num2); Vector3 val7 = val * Mathf.Cos(num3) + val3 * Mathf.Sin(num3); float num4 = (float)i / (float)segments * num; float num5 = (float)(i + 1) / (float)segments * num; AddQuadUv(v, uv, t, val4 + val6 * radius, val4 + val7 * radius, val5 + val7 * radius, val5 + val6 * radius, val6 + val7, new Vector2(num4, 0f), new Vector2(num5, 0f), new Vector2(num5, length), new Vector2(num4, length)); } UvPack.Add(count, v.Count - count); int count2 = v.Count; for (int j = 0; j < segments; j++) { float num6 = (float)j / (float)segments * (float)Math.PI * 2f; float num7 = (float)(j + 1) / (float)segments * (float)Math.PI * 2f; Vector3 val8 = val * Mathf.Cos(num6) + val3 * Mathf.Sin(num6); Vector3 val9 = val * Mathf.Cos(num7) + val3 * Mathf.Sin(num7); AddTriangleUv(v, uv, t, val5, val5 + val8 * radius, val5 + val9 * radius, axis, new Vector2(radius, radius), new Vector2(radius + Mathf.Cos(num6) * radius, radius + Mathf.Sin(num6) * radius), new Vector2(radius + Mathf.Cos(num7) * radius, radius + Mathf.Sin(num7) * radius)); } UvPack.Add(count2, v.Count - count2); int count3 = v.Count; for (int k = 0; k < segments; k++) { float num8 = (float)k / (float)segments * (float)Math.PI * 2f; float num9 = (float)(k + 1) / (float)segments * (float)Math.PI * 2f; Vector3 val10 = val * Mathf.Cos(num8) + val3 * Mathf.Sin(num8); Vector3 val11 = val * Mathf.Cos(num9) + val3 * Mathf.Sin(num9); AddTriangleUv(v, uv, t, val4, val4 + val10 * radius, val4 + val11 * radius, -axis, new Vector2(radius, radius), new Vector2(radius + Mathf.Cos(num8) * radius, radius + Mathf.Sin(num8) * radius), new Vector2(radius + Mathf.Cos(num9) * radius, radius + Mathf.Sin(num9) * radius)); } UvPack.Add(count3, v.Count - count3); } private static void AddPrism(List<Vector3> v, List<Vector2> uv, List<int> t, Vector3 baseCenter, float halfWidth, float length, float height) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0074: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00b8: 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_00c6: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00de: Unknown result type (might be due to invalid IL or missing references) Vector3 val = baseCenter + new Vector3(0f, 0f, length); Vector3 val2 = baseCenter + new Vector3(0f - halfWidth, 0f, 0f); Vector3 val3 = baseCenter + new Vector3(halfWidth, 0f, 0f); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(0f, height, 0f); AddTriangle(v, uv, t, val + val4, val2 + val4, val3 + val4, Vector3.up); AddQuad(v, uv, t, val2, val3, val3 + val4, val2 + val4, Vector3.back); AddQuad(v, uv, t, val2, val, val + val4, val2 + val4, new Vector3(0f - length, 0f, halfWidth)); AddQuad(v, uv, t, val3, val, val + val4, val3 + val4, new Vector3(length, 0f, halfWidth)); } } [HarmonyPatch(typeof(Player), "UpdatePlacementGhost")] internal static class ConveyorPlacementPatch { private static void Postfix(Player __instance) { //IL_00c4: 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_0104: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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_0121: 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_0128: 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) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: 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_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer || (Object)(object)__instance.m_buildPieces == (Object)null || (Object)(object)__instance.m_placementGhost == (Object)null) { return; } Piece selectedPiece = __instance.m_buildPieces.GetSelectedPiece(); if ((Object)(object)selectedPiece == (Object)null || (((Object)((Component)selectedPiece).gameObject).name != "VRS_Conveyor" && !Conveyor.IsJunction(((Object)((Component)selectedPiece).gameObject).name) && !Conveyor.IsAdapter(((Object)((Component)selectedPiece).gameObject).name))) { return; } GameObject placementGhost = __instance.m_placementGhost; SocketPreview.AttachGhostArrows(placementGhost, ((Object)((Component)selectedPiece).gameObject).name); if (Conveyor.IsAdapter(((Object)((Component)selectedPiece).gameObject).name)) { AdapterPlacement.Update(__instance, placementGhost, ((Object)((Component)selectedPiece).gameObject).name); return; } Transform transform = ((Component)GameCamera.instance).transform; RaycastHit hit = default(RaycastHit); if (!Physics.Raycast(transform.position, transform.forward, ref hit, 50f, __instance.m_placeRayMask) || Vector3.Distance(((Character)__instance).m_eye.position, ((RaycastHit)(ref hit)).point) > __instance.m_maxPlaceDistance) { __instance.m_placementStatus = (PlacementStatus)1; __instance.SetPlacementGhostValid(false); return; } Vector3 normal = ((RaycastHit)(ref hit)).normal; Vector3 normalized = ((Vector3)(ref normal)).normalized; Vector3 val = Vector3.ProjectOnPlane(Vector3.forward, normalized); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.ProjectOnPlane(Vector3.up, normalized); } Quaternion val2 = Quaternion.AngleAxis((Conveyor.IsAdapter(((Object)((Component)selectedPiece).gameObject).name) ? 90f : 22.5f) * (float)__instance.m_placeRotation, normalized) * Quaternion.LookRotation(((Vector3)(ref val)).normalized, normalized); float num = (MountLift.Current = MountLift.Compute(((Object)((Component)selectedPiece).gameObject).name, hit, normalized)); Vector3 val3 = RailSnap.Apply(selectedPiece, placementGhost, ((RaycastHit)(ref hit)).point, normalized, val2); val3 -= normalized * Vector3.Dot(val3 - ((RaycastHit)(ref hit)).point, normalized); val3 += normalized * num; placementGhost.transform.SetPositionAndRotation(val3, val2); placementGhost.SetActive(true); __instance.m_placementStatus = (PlacementStatus)0; __instance.SetPlacementGhostValid(true); } } [HarmonyPatch(typeof(Player), "PlacePiece")] internal static class MachinePieceSoundPatch { private static void Postfix(Player __instance, Piece piece) { //IL_0079: 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) if (!((Object)(object)piece == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { string name = ((Object)((Component)piece).gameObject).name; if (!(name != "VRS_Conveyor") || !(name != "VRS_Splitter") || !(name != "VRS_Combiner") || Conveyor.IsAdapter(name)) { Sounds.Place(((Object)(object)__instance.m_placementGhost != (Object)null) ? __instance.m_placementGhost.transform.position : ((Component)__instance).transform.position); } } } } internal static class AdapterLink { internal const string HostKey = "vrs_host"; private const string PosKey = "vrs_host_pos"; private const string PrefabKey = "vrs_host_prefab"; private static readonly int[] Hashes = new int[3] { StringExtensionMethods.GetStableHashCode("VRS_AdapterDual"), StringExtensionMethods.GetStableHashCode("VRS_AdapterIn"), StringExtensionMethods.GetStableHashCode("VRS_AdapterOut") }; internal static readonly string[] Names = new string[3] { "VRS_AdapterDual", "VRS_AdapterIn", "VRS_AdapterOut" }; internal static bool IsAdapter(ZDO zdo) { int prefab = zdo.GetPrefab(); if (prefab != Hashes[0] && prefab != Hashes[1]) { return prefab == Hashes[2]; } return true; } internal static ZDO Resolve(ZDO zdo) { if (zdo == null) { return null; } if (!IsAdapter(zdo)) { return zdo; } return Host(zdo); } internal static ZDO Host(ZDO adapter) { //IL_0006: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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_004b: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //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) ZDOID zDOID = adapter.GetZDOID("vrs_host"); if (((ZDOID)(ref zDOID)).Equals(default(ZDOID)) || ZDOMan.instance == null) { return null; } int num = adapter.GetInt("vrs_host_prefab", 0); Vector3 vec = adapter.GetVec3("vrs_host_pos", Vector3.zero); ZDO zDO = ZDOMan.instance.GetZDO(zDOID); Vector3 val; if (zDO != null) { if (num == 0) { goto IL_007d; } if (zDO.GetPrefab() == num) { val = zDO.GetPosition() - vec; if (((Vector3)(ref val)).sqrMagnitude < 0.0004f) { goto IL_007d; } } } if (num == 0) { return null; } foreach (ZDO value in ZDOMan.instance.m_objectsByID.Values) { if (value.GetPrefab() == num) { val = value.GetPosition() - vec; if (((Vector3)(ref val)).sqrMagnitude < 0.0004f) { return value; } } } return null; IL_007d: return zDO; } internal static void Link(ZDO adapter, ZDO host)