Decompiled source of Matty Fixes Experimental v1.1.20
BepInEx/plugins/MattyFixes.dll
Decompiled 4 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Buffers; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using JetBrains.Annotations; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLevelLoader; using LethalLib.Modules; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using MattyFixes.Dependency; using MattyFixes.Utils; using Microsoft.CodeAnalysis; using Steamworks; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Pool; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: AssemblyCompany("MattyFixes")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.20.0")] [assembly: AssemblyInformationalVersion("1.1.20+0f22cf5a2f12548952e9f999829d2855cdea489e")] [assembly: AssemblyProduct("Matty's Fixes")] [assembly: AssemblyTitle("MattyFixes")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.20.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MattyFixes { [BepInPlugin("mattymatty.MattyFixes", "Matty's Fixes", "1.1.20")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class MattyFixes : BaseUnityPlugin { internal static class PluginConfig { internal static class ReadableMeshes { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<bool> FixLightning; } internal static class NameFixes { internal static ConfigEntry<bool> Enabled; } internal static class BadgeFixes { internal static ConfigEntry<bool> Enabled; } internal static class CupBoard { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<float> Tolerance; internal static ConfigEntry<float> Shift; } internal static class Radar { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<bool> RemoveDeleted; internal static ConfigEntry<bool> RemoveOnShip; } internal static class ItemClipping { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<bool> RotateOnSpawn; internal static ConfigEntry<float> VerticalOffset; internal static ConfigEntry<string> ManualOffsets; internal static readonly Dictionary<string, float> ManualOffsetMap = new Dictionary<string, float>(); internal static readonly Dictionary<Item, ItemRotationConfig> ItemRotations = new Dictionary<Item, ItemRotationConfig>(); } internal static class OutOfBounds { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<float> VerticalOffset; } internal static class LightingParticle { internal static ConfigEntry<bool> Enabled; } internal static class CruiserFixes { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<bool> AlternateItemDrop; } internal static class Debug { internal static ConfigEntry<LogLevel> VerboseMeshes; internal static ConfigEntry<LogLevel> VerboseCupboard; internal static ConfigEntry<LogLevel> VerboseItems; } internal static void Init() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Expected O, but got Unknown ConfigFile config = ((BaseUnityPlugin)Instance).Config; ReadableMeshes.Enabled = config.Bind<bool>("ReadableMeshes", "enabled", true, "convert all meshes to readable at runtime"); ReadableMeshes.FixLightning = config.Bind<bool>("ReadableMeshes", "fix_lightning", true, "show lightning particles as dev intended! ( will have no effect if AlternateLightningParticles is active )"); NameFixes.Enabled = config.Bind<bool>("NameFixes", "enabled", true, "[EXPERIMENTAL] fix late joining players reading as 'Unknown' and radar with wrong names"); BadgeFixes.Enabled = config.Bind<bool>("BadgeFixes", "enabled", true, "show correct level tag"); CupBoard.Enabled = config.Bind<bool>("CupBoard", "enabled", true, "prevent items inside or above the Storage Closet from falling to the ground"); CupBoard.Tolerance = config.Bind<float>("CupBoard", "tolerance", 0.05f, new ConfigDescription("how loosely \"close\" the items have to be to the top of the closet for them to count X/Z", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.5f), Array.Empty<object>())); CupBoard.Shift = config.Bind<float>("CupBoard", "shift", 0.1f, new ConfigDescription("how much move the items inside the closet on load ( only if ItemClippingFix disabled )", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.5f), Array.Empty<object>())); Radar.Enabled = config.Bind<bool>("Radar", "enabled", true, "remove orphan radar icons from deleted/collected scrap"); Radar.RemoveDeleted = config.Bind<bool>("Radar", "deleted_scrap", true, "remove orphan radar icons from deleted scrap ( company building )"); Radar.RemoveOnShip = config.Bind<bool>("Radar", "ship_loot", true, "remove orphan radar icons from scrap on the ship in a recently created game"); ItemClipping.Enabled = config.Bind<bool>("ItemClipping", "enabled", true, "fix rotation and height of various items when on the Ground"); ItemClipping.RotateOnSpawn = config.Bind<bool>("ItemClipping", "rotate_on_spawn", true, "fix rotation of newly spawned items"); ItemClipping.VerticalOffset = config.Bind<float>("ItemClipping", "vertical_offset", 0f, new ConfigDescription("additional y offset for items on the ground", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-0.5f, 0.5f), Array.Empty<object>())); ItemClipping.ManualOffsets = config.Bind<string>("ItemClipping", "manual_offsets", "", "y offset for items on the ground\nDictionary Format: '[key]:[value],[key2]:[value2]'"); OutOfBounds.Enabled = config.Bind<bool>("OutOfBounds", "enabled", true, "prevent items from falling below the ship"); OutOfBounds.VerticalOffset = config.Bind<float>("OutOfBounds", "vertical_offset", 0.01f, new ConfigDescription("vertical offset to apply to objects on load to prevent them from clipping into the floor", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.001f, 1f), Array.Empty<object>())); LightingParticle.Enabled = config.Bind<bool>("AlternateLightningParticles", "enabled", true, "use sphere shape for lightning particles "); CruiserFixes.Enabled = config.Bind<bool>("CruiserFixes", "enabled", true, "global toggle for cruiser patches"); CruiserFixes.AlternateItemDrop = config.Bind<bool>("CruiserFixes", "alternate_item_drop", true, "global toggle for cruiser patches"); Debug.VerboseMeshes = config.Bind<LogLevel>("Debug", "Mesh Verbosity Level", (LogLevel)0, "Print A LOT more logs about Meshes"); Debug.VerboseCupboard = config.Bind<LogLevel>("Debug", "Cupboard Verbosity Level", (LogLevel)0, "Print A LOT more logs about Cupboard detection"); Debug.VerboseItems = config.Bind<LogLevel>("Debug", "Item Verbosity Level", (LogLevel)0, "Print A LOT more logs about Cupboard detection"); string value = ItemClipping.ManualOffsets.Value; string[] array = value.Split(','); foreach (string text in array) { string[] array2 = text.Split(':'); if (array2.Length > 1) { string key = array2[0].Trim(); if (float.TryParse(array2[1], NumberStyles.Float | NumberStyles.AllowThousands, NumberFormatInfo.InvariantInfo, out var result)) { ItemClipping.ManualOffsetMap.Add(key, result); } } } if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddButton("Cleanup", "Clear old entries", "remove unused entries in the config file\n(IF RUN FROM MENU WILL DELETE ALL ITEM OFFSETS!!)", "Clean&Save", RemoveOrphans); LethalConfigProxy.AddConfig(ReadableMeshes.Enabled, requiresRestart: true); LethalConfigProxy.AddConfig(ReadableMeshes.FixLightning); LethalConfigProxy.AddConfig(NameFixes.Enabled); LethalConfigProxy.AddConfig(BadgeFixes.Enabled, requiresRestart: true); LethalConfigProxy.AddConfig(CupBoard.Enabled); LethalConfigProxy.AddConfig(CupBoard.Tolerance); LethalConfigProxy.AddConfig(CupBoard.Shift); LethalConfigProxy.AddConfig(Radar.Enabled); LethalConfigProxy.AddConfig(Radar.RemoveDeleted); LethalConfigProxy.AddConfig(Radar.RemoveOnShip); LethalConfigProxy.AddConfig(ItemClipping.Enabled); LethalConfigProxy.AddConfig(ItemClipping.RotateOnSpawn); LethalConfigProxy.AddConfig(ItemClipping.VerticalOffset); LethalConfigProxy.AddConfig(ItemClipping.ManualOffsets, requiresRestart: true); LethalConfigProxy.AddConfig(OutOfBounds.Enabled); LethalConfigProxy.AddConfig(LightingParticle.Enabled, requiresRestart: true); LethalConfigProxy.AddConfig(CruiserFixes.Enabled); LethalConfigProxy.AddConfig(CruiserFixes.AlternateItemDrop); LethalConfigProxy.AddConfig<LogLevel>(Debug.VerboseMeshes, requiresRestart: false); LethalConfigProxy.AddConfig<LogLevel>(Debug.VerboseCupboard, requiresRestart: false); LethalConfigProxy.AddConfig<LogLevel>(Debug.VerboseItems, requiresRestart: false); } } internal static void RemoveOrphans() { ConfigFile config = ((BaseUnityPlugin)Instance).Config; PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null); dictionary.Clear(); config.Save(); } } internal readonly struct ItemRotationConfig { public Vector3 Original { get; } public ConfigEntry<string> Config { get; } public ItemRotationConfig(Vector3 original, ConfigEntry<string> config) { //IL_0001: 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) Original = original; Config = config; } } public const string GUID = "mattymatty.MattyFixes"; public const string NAME = "Matty's Fixes"; public const string VERSION = "1.1.20"; internal static ManualLogSource Log; internal static MattyFixes Instance { get; private set; } private void Awake() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } Log = ((BaseUnityPlugin)this).Logger; try { if (LobbyCompatibilityChecker.Enabled) { LobbyCompatibilityChecker.Init(); } Log.LogInfo((object)"Initializing Configs"); PluginConfig.Init(); Log.LogInfo((object)"Patching Methods"); Harmony val = new Harmony("mattymatty.MattyFixes"); val.PatchAll(Assembly.GetExecutingAssembly()); Log.LogInfo((object)"Matty's Fixes v1.1.20 Loaded!"); } catch (Exception ex) { Log.LogError((object)("Exception while initializing: \n" + ex)); } } internal static void VerboseMeshLog(LogLevel logLevel, Func<string> message) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) if ((PluginConfig.Debug.VerboseMeshes.Value & logLevel) != 0) { Log.Log(logLevel, (object)message()); } } internal static void VerboseCupboardLog(LogLevel logLevel, Func<string> message) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) if ((PluginConfig.Debug.VerboseCupboard.Value & logLevel) != 0) { Log.Log(logLevel, (object)message()); } } internal static void VerboseItemsLog(LogLevel logLevel, Func<string> message) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) if ((PluginConfig.Debug.VerboseItems.Value & logLevel) != 0) { Log.Log(logLevel, (object)message()); } } } } namespace MattyFixes.Utils { public static class VerticesExtensions { private static readonly Dictionary<Mesh, Vector3[]> VerticesCache = new Dictionary<Mesh, Vector3[]>(); public static bool TryGetVerticalOffset(this GrabbableObject target, out float offset) { //IL_0007: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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) Transform transform = ((Component)target).transform; Matrix4x4 localMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(target.itemProperties.restingRotation.x, (float)target.itemProperties.floorYOffset + 90f, target.itemProperties.restingRotation.z), transform.localScale); List<Vector3> list = CollectionPool<List<Vector3>, Vector3>.Get(); transform.GetChildVertexes(list, localMatrix, "", Logfunc); bool result = TryGetVerticalOffset(list, out offset); CollectionPool<List<Vector3>, Vector3>.Release(list); return result; static string Logfunc(List<Vector3> vertices) { if (!TryGetVerticalOffset(vertices, out var offset2)) { return ""; } return $"offset {offset2}"; } } public static bool TryGetLocalCentroid(this GameObject target, out Vector3 centroid) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_001e: 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) Transform transform = target.transform; Matrix4x4 localMatrix = Matrix4x4.TRS(transform.localPosition, transform.localRotation, transform.localScale); List<Vector3> list = CollectionPool<List<Vector3>, Vector3>.Get(); transform.GetChildVertexes(list, localMatrix, "", Logfunc); bool result = TryGetCentroid(list, out centroid); CollectionPool<List<Vector3>, Vector3>.Release(list); return result; static string Logfunc(List<Vector3> vertices) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!TryGetCentroid(vertices, out var centroid2)) { return ""; } return $"centroid {centroid2}"; } } public static bool TryGetWorldCentroid(this GameObject target, out Vector3 centroid) { //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_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_004a: Unknown result type (might be due to invalid IL or missing references) Transform transform = target.transform; List<Vector3> list = CollectionPool<List<Vector3>, Vector3>.Get(); transform.GetChildVertexes(list, Matrix4x4.identity, "", Logfunc); NativeArray<Vector3> val = ListExtensions.ToNativeArray<Vector3>(list, AllocatorManager.Temp); try { transform.TransformPoints(NativeArray<Vector3>.op_Implicit(ref val)); list.Clear(); list.AddRange((IEnumerable<Vector3>)(object)val); bool result = TryGetCentroid(list, out centroid); CollectionPool<List<Vector3>, Vector3>.Release(list); return result; } finally { ((IDisposable)val).Dispose(); } static string Logfunc(List<Vector3> vertices) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!TryGetCentroid(vertices, out var centroid2)) { return ""; } return $"centroid {centroid2}"; } } public static bool TryGetRadius(this GameObject target, out float minRadius, out float maxRadius) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_001e: 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) Transform transform = target.transform; Matrix4x4 localMatrix = Matrix4x4.TRS(transform.localPosition, transform.localRotation, transform.localScale); List<Vector3> list = CollectionPool<List<Vector3>, Vector3>.Get(); transform.GetChildVertexes(list, localMatrix, "", Logfunc); bool result = TryGetRadius(list, out minRadius, out maxRadius); CollectionPool<List<Vector3>, Vector3>.Release(list); return result; static string Logfunc(List<Vector3> vertices) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (vertices.Count == 0) { return ""; } TryGetCentroid(vertices, out var centroid); TryGetRadius(vertices, out var minRadius2, out var maxRadius2); return $"centroid {centroid} minR {minRadius2} maxR {maxRadius2}"; } } public static void GetChildVertexes(this Transform target, List<Vector3> outVertices, Matrix4x4 localMatrix = default(Matrix4x4), string path = "", Func<List<Vector3>, string> logFunc = null) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Expected O, but got Unknown //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: 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_035f: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) MattyFixes.VerboseMeshLog((LogLevel)32, () => "Processing " + path + "/" + ((Object)target).name); ScanNodeProperties val = default(ScanNodeProperties); if (((Component)target).TryGetComponent<ScanNodeProperties>(ref val)) { MattyFixes.VerboseMeshLog((LogLevel)32, () => "Skipping " + path + "/" + ((Object)target).name + "!"); return; } List<Renderer> list = default(List<Renderer>); PooledObject<List<Renderer>> val2 = CollectionPool<List<Renderer>, Renderer>.Get(ref list); try { ((Component)target).GetComponents<Renderer>(list); List<Vector3> list2 = default(List<Vector3>); PooledObject<List<Vector3>> val3 = CollectionPool<List<Vector3>, Vector3>.Get(ref list2); try { List<Vector3> rVertices = default(List<Vector3>); List<Vector3> list3 = default(List<Vector3>); foreach (Renderer renderer in list.Where((Renderer r) => r.enabled)) { PooledObject<List<Vector3>> val4 = CollectionPool<List<Vector3>, Vector3>.Get(ref rVertices); try { Renderer obj = renderer; SkinnedMeshRenderer val5 = (SkinnedMeshRenderer)(object)((obj is SkinnedMeshRenderer) ? obj : null); if (val5 == null) { if (!(renderer is MeshRenderer)) { if (!(renderer is ParticleSystemRenderer)) { Bounds bounds = renderer.bounds; rVertices.Add(((Bounds)(ref bounds)).min); rVertices.Add(new Vector3(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.z)); rVertices.Add(new Vector3(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds)).max.z)); rVertices.Add(new Vector3(((Bounds)(ref bounds)).max.x, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.z)); rVertices.Add(new Vector3(((Bounds)(ref bounds)).max.x, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).min.z)); rVertices.Add(new Vector3(((Bounds)(ref bounds)).max.x, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds)).min.z)); rVertices.Add(((Bounds)(ref bounds)).max); } goto IL_0472; } MeshFilter component = ((Component)renderer).GetComponent<MeshFilter>(); if ((Object)(object)component == (Object)null) { MattyFixes.VerboseMeshLog((LogLevel)4, () => $"{((object)renderer).GetType()} in {path} is missing a MeshFilter"); continue; } Mesh sharedMesh = component.sharedMesh; if ((Object)(object)sharedMesh == (Object)null) { MattyFixes.VerboseMeshLog((LogLevel)4, () => $"{((object)renderer).GetType()} in {path} is missing a mesh"); continue; } if (VerticesCache.TryGetValue(sharedMesh, out var value)) { rVertices.AddRange(value); } else { if (sharedMesh.isReadable) { sharedMesh.GetVertices(rVertices); } else { sharedMesh.GetNonReadableVertices(rVertices); } VerticesCache[sharedMesh] = rVertices.ToArray(); } goto IL_0472; } Mesh sharedMesh2 = val5.sharedMesh; if ((Object)(object)sharedMesh2 == (Object)null) { MattyFixes.VerboseMeshLog((LogLevel)4, () => $"{((object)renderer).GetType()} in {path} is missing a mesh"); continue; } if (VerticesCache.TryGetValue(sharedMesh2, out var value2)) { rVertices.AddRange(value2); } else { Matrix4x4 val6 = Matrix4x4.TRS(target.localPosition, target.localRotation, target.localScale); Matrix4x4 inverse = ((Matrix4x4)(ref val6)).inverse; PooledObject<List<Vector3>> val7 = CollectionPool<List<Vector3>, Vector3>.Get(ref list3); try { Mesh val8 = new Mesh(); val5.BakeMesh(val8, false); if (val8.isReadable) { val8.GetVertices(list3); } else { val8.GetNonReadableVertices(list3); } rVertices.AddRange(((IEnumerable<Vector3>)list3).Select((Func<Vector3, Vector3>)((Matrix4x4)(object)inverse).MultiplyPoint3x4)); Object.Destroy((Object)(object)val8); } finally { ((IDisposable)val7).Dispose(); } VerticesCache[sharedMesh2] = rVertices.ToArray(); } goto IL_0472; IL_0472: MattyFixes.VerboseMeshLog((LogLevel)32, () => "Processing " + path + "/" + ((Object)target).name + " renderer " + ((object)renderer).GetType().Name + " " + logFunc?.Invoke(rVertices)); list2.AddRange(rVertices); } finally { ((IDisposable)val4).Dispose(); } } foreach (Transform item in ((Component)target).transform) { Transform val9 = item; if (((Component)val9).gameObject.activeSelf) { Matrix4x4 localMatrix2 = Matrix4x4.TRS(val9.localPosition, val9.localRotation, val9.localScale); List<Vector3> list4 = CollectionPool<List<Vector3>, Vector3>.Get(); val9.GetChildVertexes(list4, localMatrix2, path + "/" + ((Object)target).name, logFunc); list2.AddRange(list4); CollectionPool<List<Vector3>, Vector3>.Release(list4); } } outVertices.AddRange(((IEnumerable<Vector3>)list2).Select((Func<Vector3, Vector3>)((Matrix4x4)(object)localMatrix).MultiplyPoint3x4)); } finally { ((IDisposable)val3).Dispose(); } MattyFixes.VerboseMeshLog((LogLevel)32, () => "Found " + path + "/" + ((Object)target).name + " " + logFunc?.Invoke(outVertices)); } finally { ((IDisposable)val2).Dispose(); } } public static void CacheChildVertexes(this Transform target, string path = "") { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown MattyFixes.VerboseMeshLog((LogLevel)16, () => "Caching " + path + "/" + ((Object)target).name); ScanNodeProperties val = default(ScanNodeProperties); if (((Component)target).TryGetComponent<ScanNodeProperties>(ref val)) { MattyFixes.VerboseMeshLog((LogLevel)32, () => "Skipping " + path + "/" + ((Object)target).name + "!"); return; } List<Renderer> list = default(List<Renderer>); PooledObject<List<Renderer>> val2 = CollectionPool<List<Renderer>, Renderer>.Get(ref list); try { ((Component)target).GetComponents<Renderer>(list); foreach (Renderer renderer in list.Where((Renderer r) => r.enabled)) { Renderer obj = renderer; SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((obj is SkinnedMeshRenderer) ? obj : null); if (val3 == null) { if (!(renderer is MeshRenderer)) { if (renderer is ParticleSystemRenderer) { } } else { MeshFilter component = ((Component)renderer).GetComponent<MeshFilter>(); if ((Object)(object)component == (Object)null) { MattyFixes.VerboseMeshLog((LogLevel)4, () => $"{((object)renderer).GetType()} in {path} is missing a MeshFilter"); continue; } Mesh sharedMesh = component.sharedMesh; if ((Object)(object)sharedMesh == (Object)null) { MattyFixes.VerboseMeshLog((LogLevel)4, () => $"{((object)renderer).GetType()} in {path} is missing a mesh"); continue; } if (!VerticesCache.ContainsKey(sharedMesh)) { if (sharedMesh.isReadable) { sharedMesh.CacheVertices(); } else { sharedMesh.CacheNonReadableVertices(); } } } } else { Mesh sharedMesh2 = val3.sharedMesh; if ((Object)(object)sharedMesh2 == (Object)null) { MattyFixes.VerboseMeshLog((LogLevel)4, () => $"{((object)renderer).GetType()} in {path} is missing a mesh"); continue; } if (!VerticesCache.ContainsKey(sharedMesh2)) { Mesh val4 = new Mesh(); val3.BakeMesh(val4, true); if (val4.isReadable) { val4.CacheVertices(sharedMesh2); } else { val4.CacheNonReadableVertices(sharedMesh2); } Object.Destroy((Object)(object)val4); } } MattyFixes.VerboseMeshLog((LogLevel)32, () => "Caching " + path + "/" + ((Object)target).name + " renderer " + ((object)renderer).GetType().Name); foreach (Transform item in ((Component)target).transform) { Transform target2 = item; target2.CacheChildVertexes(path + "/" + ((Object)target).name); } } } finally { ((IDisposable)val2).Dispose(); } } private static void GetNonReadableVertices(this Mesh nonReadableMesh, List<Vector3> vertices) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0064: 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) Mesh val = new Mesh(); nonReadableMesh.vertexBufferTarget = (Target)1; if (nonReadableMesh.vertexBufferCount > 0) { GraphicsBuffer vertexBuffer = nonReadableMesh.GetVertexBuffer(0); int num = vertexBuffer.stride * vertexBuffer.count; byte[] array = ArrayPool<byte>.Shared.Rent(num); vertexBuffer.GetData((Array)array, 0, 0, num); int vertexAttributeCount = nonReadableMesh.vertexAttributeCount; NativeArray<VertexAttributeDescriptor> val2 = default(NativeArray<VertexAttributeDescriptor>); val2..ctor(vertexAttributeCount, (Allocator)2, (NativeArrayOptions)1); for (int i = 0; i < vertexAttributeCount; i++) { val2[i] = nonReadableMesh.GetVertexAttribute(i); } val.SetVertexBufferParams(nonReadableMesh.vertexCount, val2); val.SetVertexBufferData<byte>(array, 0, 0, num, 0, (MeshUpdateFlags)0); ArrayPool<byte>.Shared.Return(array); val2.Dispose(); vertexBuffer.Dispose(); } val.GetVertices(vertices); Object.Destroy((Object)(object)val); } private static void CacheNonReadableVertices(this Mesh nonReadableMesh, Mesh cacheKey = null) { //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (VerticesCache.ContainsKey(nonReadableMesh)) { return; } nonReadableMesh.vertexBufferTarget = (Target)1; if (nonReadableMesh.vertexBufferCount <= 0) { return; } GraphicsBuffer verticesBuffer = nonReadableMesh.GetVertexBuffer(0); int totalSize = verticesBuffer.stride * verticesBuffer.count; VertexAttributeDescriptor[] attributes = nonReadableMesh.GetVertexAttributes(); int count = nonReadableMesh.vertexCount; MattyFixes.VerboseMeshLog((LogLevel)8, () => $"Requesting vertices for {nonReadableMesh} from GPU"); AsyncGPUReadback.Request(verticesBuffer, totalSize, 0, (Action<AsyncGPUReadbackRequest>)delegate(AsyncGPUReadbackRequest request) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) verticesBuffer.Release(); if (!VerticesCache.ContainsKey(nonReadableMesh)) { Mesh val = new Mesh(); NativeArray<byte> data = ((AsyncGPUReadbackRequest)(ref request)).GetData<byte>(0); val.SetVertexBufferParams(count, attributes); val.SetVertexBufferData<byte>(data, 0, 0, totalSize, 0, (MeshUpdateFlags)0); List<Vector3> tmp = default(List<Vector3>); PooledObject<List<Vector3>> val2 = CollectionPool<List<Vector3>, Vector3>.Get(ref tmp); try { val.GetVertices(tmp); MattyFixes.VerboseMeshLog((LogLevel)16, () => $"Cached {tmp.Count} vertices for {nonReadableMesh}"); VerticesCache[((Object)(object)cacheKey != (Object)null) ? cacheKey : nonReadableMesh] = tmp.ToArray(); } finally { ((IDisposable)val2).Dispose(); } Object.Destroy((Object)(object)val); } }); } private static void CacheVertices(this Mesh readableMesh, Mesh cacheKey = null) { //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) if (VerticesCache.ContainsKey(readableMesh)) { return; } List<Vector3> tmp = default(List<Vector3>); PooledObject<List<Vector3>> val = CollectionPool<List<Vector3>, Vector3>.Get(ref tmp); try { readableMesh.GetVertices(tmp); MattyFixes.VerboseMeshLog((LogLevel)16, () => $"Cached {tmp.Count} vertices for {readableMesh}"); VerticesCache[((Object)(object)cacheKey != (Object)null) ? cacheKey : readableMesh] = tmp.ToArray(); } finally { ((IDisposable)val).Dispose(); } } private static bool TryGetVerticalOffset(List<Vector3> vertices, out float offset) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) offset = 0f; if (vertices.Count == 0) { return false; } float num = float.MaxValue; foreach (Vector3 vertex in vertices) { if (vertex.y < num) { num = vertex.y; } } offset = 0f - num; return true; } private static bool TryGetCentroid(List<Vector3> vertices, out Vector3 centroid) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_004e: 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) centroid = Vector3.zero; if (vertices.Count == 0) { return false; } Vector3 val = Vector3.zero; foreach (Vector3 vertex in vertices) { val += vertex; } centroid = val / (float)vertices.Count; return true; } private static bool TryGetRadius(List<Vector3> vertices, out float minRadius, out float maxRadius) { //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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) minRadius = 0f; maxRadius = 0f; if (vertices.Count == 0) { return false; } TryGetCentroid(vertices, out var centroid); minRadius = float.MaxValue; maxRadius = float.MinValue; foreach (Vector3 vertex in vertices) { Vector3 val = vertex - centroid; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < minRadius) { minRadius = sqrMagnitude; } if (sqrMagnitude > maxRadius) { maxRadius = sqrMagnitude; } } minRadius = Mathf.Sqrt(minRadius); maxRadius = Mathf.Sqrt(maxRadius); return true; } } } namespace MattyFixes.Patches { [HarmonyPatch] internal class CruiserFixes { [HarmonyTranspiler] [HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")] private static IEnumerable<CodeInstruction> PreventCruiserDrop(IEnumerable<CodeInstruction> instructions, ILGenerator ilGenerator) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); MethodInfo methodInfo = AccessTools.Method(typeof(CruiserFixes), "AlternateCruiserParenting", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Object), "op_Inequality", (Type[])null, (Type[])null); CodeMatcher val = new CodeMatcher((IEnumerable<CodeInstruction>)list, ilGenerator); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[4] { new CodeMatch((OpCode?)OpCodes.Ldloc_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldnull, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)methodInfo2, (string)null), new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }); if (!val.IsValid) { MattyFixes.Log.LogError((object)"Failed to patch DiscardHeldObject for Cruiser!"); MattyFixes.Log.LogWarning((object)("DiscardHeldObject:\n" + string.Join("\n", val.Instructions()))); return list; } object operand = val.Operand; val.Advance(1); val.Insert((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brtrue, operand) }); return val.Instructions(); } [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")] private static void PreventCruiserDrop(PlayerControllerB __instance, ref bool placeObject, ref NetworkObject parentObjectTo, ref Vector3 placePosition, ref bool matchRotationOfParent) { //IL_0031: 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_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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_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) if (!AlternateCruiserParenting() || placeObject) { return; } GrabbableObject currentlyHeldObjectServer = __instance.currentlyHeldObjectServer; if (!((Component)currentlyHeldObjectServer).gameObject.TryGetWorldCentroid(out var centroid)) { centroid = ((Component)currentlyHeldObjectServer).transform.position; } RaycastHit val = default(RaycastHit); Transform val2 = null; if (Physics.Raycast(centroid, -((Component)__instance).transform.up, ref val, 4f, 1342179585, (QueryTriggerInteraction)1)) { val2 = ((Component)((RaycastHit)(ref val)).collider).gameObject.transform; } if ((Object)(object)val2 == (Object)null) { return; } PlayerPhysicsRegion componentInChildren = ((Component)val2).GetComponentInChildren<PlayerPhysicsRegion>(); if (!((Object)(object)componentInChildren == (Object)null) && componentInChildren.allowDroppingItems && !(componentInChildren.itemDropCollider.ClosestPoint(((RaycastHit)(ref val)).point) != ((RaycastHit)(ref val)).point)) { NetworkObject componentInParent = ((Component)val2).GetComponentInParent<NetworkObject>(); if (!((Object)(object)componentInParent == (Object)null)) { float num = 0.04f + currentlyHeldObjectServer.itemProperties.verticalOffset; MattyFixes.Log.LogInfo((object)"parenting item to Cruiser"); placePosition = ((Component)componentInParent).transform.InverseTransformPoint(((RaycastHit)(ref val)).point + ((RaycastHit)(ref val)).transform.up * num); parentObjectTo = componentInParent; placeObject = true; matchRotationOfParent = false; } } } private static bool AlternateCruiserParenting() { if (MattyFixes.PluginConfig.CruiserFixes.Enabled.Value) { return MattyFixes.PluginConfig.CruiserFixes.AlternateItemDrop.Value; } return false; } } [HarmonyPatch] internal class CupBoardFix { internal struct ClosetHolder { public readonly UnlockableItem Unlockable; public readonly GameObject gameObject; public readonly List<ShelfHolder> Shelves; public readonly Collider Collider; public bool IsInitialized; public ClosetHolder() { IsInitialized = false; Unlockable = StartOfRound.Instance.unlockablesList.unlockables.Find((UnlockableItem u) => u.unlockableName == "Cupboard"); gameObject = GameObject.Find("/Environment/HangarShip/StorageCloset"); Collider = gameObject.GetComponent<Collider>(); Shelves = gameObject.GetComponentsInChildren<PlaceableObjectsSurface>().Select(delegate(PlaceableObjectsSurface s) { ShelfHolder result = default(ShelfHolder); result.Shelf = s; result.Collider = ((Component)s).GetComponent<Collider>(); return result; }).ToList(); } } internal struct ShelfHolder { public PlaceableObjectsSurface Shelf; public Collider Collider; } private static ClosetHolder? _closet; internal static ClosetHolder Closet { get { ClosetHolder valueOrDefault = _closet.GetValueOrDefault(); if (!_closet.HasValue) { valueOrDefault = new ClosetHolder(); _closet = valueOrDefault; } return _closet.Value; } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "OnLocalDisconnect")] [HarmonyPatch(typeof(StartOfRound), "OnDestroy")] private static void ResetOnDisconnect() { _closet = null; } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesClientRpc")] private static void AfterCupboardSync(StartOfRound __instance) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening || (int)((NetworkBehaviour)__instance).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || ((NetworkBehaviour)__instance).IsServer) { return; } ClosetHolder closet = Closet; if (closet.IsInitialized) { MattyFixes.VerboseCupboardLog((LogLevel)4, () => "SyncShipUnlockablesClientRpc Cupboard Triggered but was already Initialized!"); return; } closet.IsInitialized = true; if (closet.Unlockable.inStorage) { return; } closet.gameObject.GetComponent<AutoParentToShip>().MoveToOffset(); Physics.SyncTransforms(); GrabbableObject[] source = Object.FindObjectsOfType<GrabbableObject>(); foreach (GrabbableObject item in source.Where((GrabbableObject g) => g.isInShipRoom)) { float offset = 0f; if (item.hasHitGround) { offset = item.itemProperties.verticalOffset; } ShelfCheck(item, offset); } } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(StartOfRound), "LoadShipGrabbableItems")] private static void OnServerSpawn(GrabbableObject __instance) { ClosetHolder closet = Closet; if (closet.IsInitialized) { MattyFixes.VerboseCupboardLog((LogLevel)4, () => "LoadShipGrabbableItems Cupboard Triggered but was already Initialized!"); return; } closet.IsInitialized = true; if (closet.Unlockable.inStorage) { return; } closet.gameObject.GetComponent<AutoParentToShip>().MoveToOffset(); Physics.SyncTransforms(); GrabbableObject[] source = Object.FindObjectsOfType<GrabbableObject>(); foreach (GrabbableObject item in source.Where((GrabbableObject g) => g.isInShipRoom)) { ShelfCheck(item); } } private static void ShelfCheck(GrabbableObject grabbable, float offset = 0f) { //IL_0084: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_030b: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_01fa: Unknown result type (might be due to invalid IL or missing references) MattyFixes.VerboseCupboardLog((LogLevel)16, () => $"{grabbable.itemProperties.itemName}({((NetworkBehaviour)grabbable).NetworkObjectId}) - Cupboard Triggered!"); if (grabbable is ClipboardItem || (grabbable is PhysicsProp && grabbable.itemProperties.itemName == "Sticky note")) { return; } float value = MattyFixes.PluginConfig.CupBoard.Tolerance.Value; float num = value * value; try { Vector3 pos = ((Component)grabbable).transform.position + Vector3.down * offset; MattyFixes.VerboseCupboardLog((LogLevel)32, () => $"{grabbable.itemProperties.itemName}({((NetworkBehaviour)grabbable).NetworkObjectId}) - Item pos {pos}!"); ClosetHolder closet = Closet; float distance = float.MaxValue; PlaceableObjectsSurface val = null; Vector3? closest = null; MattyFixes.VerboseCupboardLog((LogLevel)32, delegate { //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_0042: Unknown result type (might be due to invalid IL or missing references) string itemName = grabbable.itemProperties.itemName; object arg2 = ((NetworkBehaviour)grabbable).NetworkObjectId; Bounds bounds2 = closet.Collider.bounds; return $"{itemName}({arg2}) - Cupboard pos {((Bounds)(ref bounds2)).min}!"; }); Collider collider = closet.Collider; float y = pos.y; Bounds bounds = collider.bounds; if (y < ((Bounds)(ref bounds)).max.y) { bounds = collider.bounds; if (((Bounds)(ref bounds)).SqrDistance(pos) <= num) { foreach (ShelfHolder shelf in closet.Shelves) { Vector3 val2 = shelf.Collider.ClosestPoint(pos); float tmp = pos.y - val2.y; MattyFixes.VerboseCupboardLog((LogLevel)32, () => $"{grabbable.itemProperties.itemName}({((NetworkBehaviour)grabbable).NetworkObjectId}) - Shelve is {tmp} away!"); if (tmp >= 0f && tmp < distance) { val = shelf.Shelf; distance = tmp; closest = val2; } } MattyFixes.VerboseCupboardLog((LogLevel)32, () => $"{grabbable.itemProperties.itemName}({((NetworkBehaviour)grabbable).NetworkObjectId}) - Chosen Shelve is {distance} away!"); MattyFixes.VerboseCupboardLog((LogLevel)32, () => $"{grabbable.itemProperties.itemName}({((NetworkBehaviour)grabbable).NetworkObjectId}) - With hitpoint at {closest}!"); } } Transform transform = ((Component)grabbable).transform; if ((Object)(object)val != (Object)null) { Vector3 newPos; if (MattyFixes.PluginConfig.ItemClipping.Enabled.Value) { newPos = ItemPatches.FixPlacement(closest.Value, ((Component)val).transform, grabbable); } else { newPos = closest.Value + Vector3.up * MattyFixes.PluginConfig.CupBoard.Shift.Value; } transform.parent = closet.gameObject.transform; transform.position = newPos; grabbable.targetFloorPosition = transform.localPosition; MattyFixes.VerboseCupboardLog((LogLevel)16, () => $"{grabbable.itemProperties.itemName}({((NetworkBehaviour)grabbable).NetworkObjectId}) - Pos on shelf {newPos}!"); } } catch (Exception arg) { MattyFixes.Log.LogError((object)$"Exception while checking for Cupboard {arg}"); } } } [HarmonyPatch] internal class GrabbableStartPatch { [HarmonyTranspiler] [HarmonyPatch(typeof(GrabbableObject), "Start")] private static IEnumerable<CodeInstruction> RedirectSpawnOnGroundCheck(IEnumerable<CodeInstruction> instructions) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); FieldInfo fieldInfo = AccessTools.Field(typeof(GrabbableObject), "itemProperties"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Item), "itemSpawnsOnGround"); MethodInfo methodInfo = AccessTools.Method(typeof(GrabbableStartPatch), "NewSpawnOnGroundCheck", (Type[])null, (Type[])null); CodeMatcher val = new CodeMatcher((IEnumerable<CodeInstruction>)list, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[4] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo2, (string)null), new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null) }); if (val.IsInvalid) { return list; } val.Advance(1); val.RemoveInstructions(2); val.Insert((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)methodInfo) }); MattyFixes.Log.LogDebug((object)"GrabbableObject.Start patched!"); return val.Instructions(); } private static bool NewSpawnOnGroundCheck(GrabbableObject grabbableObject) { bool ret = grabbableObject.itemProperties.itemSpawnsOnGround; MattyFixes.VerboseItemsLog((LogLevel)32, () => $"{grabbableObject.itemProperties.itemName}({((NetworkBehaviour)grabbableObject).NetworkObjectId}) processing GrabbableObject pos {((Component)grabbableObject).transform.position}"); if (!MattyFixes.PluginConfig.OutOfBounds.Enabled.Value && !MattyFixes.PluginConfig.CupBoard.Enabled.Value) { return ret; } if (grabbableObject is ClipboardItem || (grabbableObject is PhysicsProp && grabbableObject.itemProperties.itemName == "Sticky note")) { return ret; } if (!Object.op_Implicit((Object)(object)StartOfRound.Instance.localPlayerController) || StartOfRoundPatch._isInitializingGame) { if (MattyFixes.PluginConfig.OutOfBounds.Enabled.Value) { ret = ((NetworkBehaviour)grabbableObject).IsServer; } if (MattyFixes.PluginConfig.CupBoard.Enabled.Value && Object.op_Implicit((Object)(object)CupBoardFix.Closet.gameObject) && (Object)(object)((Component)grabbableObject).transform.parent == (Object)(object)CupBoardFix.Closet.gameObject.transform) { ret = false; } } MattyFixes.VerboseItemsLog((LogLevel)32, () => $"{grabbableObject.itemProperties.itemName}({((NetworkBehaviour)grabbableObject).NetworkObjectId}) processing GrabbableObject spawnState " + $"OnGround - was: {grabbableObject.itemProperties.itemSpawnsOnGround} new:{ret}"); return ret; } } [HarmonyPatch] internal static class ItemPatches { [HarmonyPatch(typeof(NetworkBehaviour), "OnNetworkSpawn")] internal static class NetworkSpawnPatch { [HarmonyPrefix] [HarmonyPriority(900)] private static void Prefix(NetworkBehaviour __instance) { GrabbableObject val = (GrabbableObject)(object)((__instance is GrabbableObject) ? __instance : null); if (val == null) { return; } Item itemProperties = val.itemProperties; if (!ComputedItems.Add(itemProperties)) { return; } if (itemProperties.isConductiveMetal && MattyFixes.PluginConfig.ReadableMeshes.Enabled.Value && MattyFixes.PluginConfig.ReadableMeshes.FixLightning.Value && !MattyFixes.PluginConfig.LightingParticle.Enabled.Value) { try { if ((Object)(object)itemProperties.spawnPrefab != (Object)null) { MakeMeshReadable(itemProperties.spawnPrefab); } } catch (Exception arg) { MattyFixes.Log.LogError((object)$"{itemProperties.itemName} Failed to mark prefab Mesh Readable! {arg}"); BrokenMeshItems.Add(itemProperties); MattyFixes.Log.LogWarning((object)(itemProperties.itemName + " Added to the ignored Meshes!")); } } if (!MattyFixes.PluginConfig.ItemClipping.Enabled.Value) { return; } try { if (!MattyFixes.PluginConfig.ItemClipping.ManualOffsetMap.TryGetValue(itemProperties.itemName, out var value)) { GameObject val2 = itemProperties.spawnPrefab; if ((Object)(object)val2 == (Object)null) { val2 = ((Component)__instance).gameObject; } GrabbableObject componentInChildren = val2.GetComponentInChildren<GrabbableObject>(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { throw new ArgumentNullException("GrabbableObject", "Cannot find GrabbableObject on prefab!"); } value = ((!componentInChildren.TryGetVerticalOffset(out value)) ? itemProperties.verticalOffset : (value + MattyFixes.PluginConfig.ItemClipping.VerticalOffset.Value)); } itemProperties.verticalOffset = value; MattyFixes.Log.LogDebug((object)$"{itemProperties.itemName} new offset is {itemProperties.verticalOffset}"); } catch (Exception arg2) { MattyFixes.Log.LogError((object)$"{itemProperties.itemName} Failed to compute vertical offset! {arg2}"); } } [HarmonyPostfix] [HarmonyPriority(-900)] private static void Postfix(NetworkBehaviour __instance) { //IL_00a3: 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_0102: Unknown result type (might be due to invalid IL or missing references) GrabbableObject val = (GrabbableObject)(object)((__instance is GrabbableObject) ? __instance : null); if (val == null || val is ClipboardItem || (val is PhysicsProp && val.itemProperties.itemName == "Sticky note") || (Object.op_Implicit((Object)(object)StartOfRound.Instance.localPlayerController) && !StartOfRoundPatch._isInitializingGame)) { return; } try { val.isInElevator = true; val.isInShipRoom = true; LungProp val2 = (LungProp)(object)((val is LungProp) ? val : null); if (val2 != null) { val2.isLungDocked = false; val2.isLungPowered = false; val2.isLungDockedInElevator = false; AudioSource component = ((Component)val2).GetComponent<AudioSource>(); if (component != null) { component.Stop(); } } if (MattyFixes.PluginConfig.ItemClipping.RotateOnSpawn.Value) { val.floorYRot = (int)Math.Floor(((Component)val).transform.eulerAngles.y - 90f - (float)val.itemProperties.floorYOffset); ((Component)val).transform.rotation = Quaternion.Euler(val.itemProperties.restingRotation.x, ((Component)val).transform.eulerAngles.y, val.itemProperties.restingRotation.z); } } catch (Exception arg) { MattyFixes.Log.LogError((object)$"Exception while setting rotation :{arg}"); } } } [HarmonyPatch] internal class StormyWeatherPatch { [HarmonyPostfix] [HarmonyPatch(typeof(StormyWeather), "SetStaticElectricityWarning")] private static void ChangeParticleShape(StormyWeather __instance, NetworkObject warningObject) { //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_0068: 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_0079: 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_008d: Unknown result type (might be due to invalid IL or missing references) try { ShapeModule shape = __instance.staticElectricityParticle.shape; if (MattyFixes.PluginConfig.LightingParticle.Enabled.Value) { ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radiusThickness = 0.01f; if (((Component)warningObject).gameObject.TryGetRadius(out var minRadius, out var maxRadius)) { ((ShapeModule)(ref shape)).radius = maxRadius; ((ShapeModule)(ref shape)).radiusThickness = 1f - minRadius / maxRadius; ((Component)warningObject).gameObject.TryGetWorldCentroid(out var centroid); _staticElectricityParticleOffset = centroid - ((Component)warningObject).transform.position + Vector3.up * 0.5f; } return; } GrabbableObject component = ((Component)warningObject).gameObject.GetComponent<GrabbableObject>(); if (!MattyFixes.PluginConfig.ReadableMeshes.Enabled.Value || !MattyFixes.PluginConfig.ReadableMeshes.FixLightning.Value || BrokenMeshItems.Contains(component.itemProperties)) { return; } try { MakeMeshReadable(((Component)warningObject).gameObject, updateOriginal: true, ReverseMeshMap); } catch (Exception arg) { MattyFixes.Log.LogError((object)$"{component.itemProperties.itemName} Failed to mark prefab Mesh Readable! {arg}"); BrokenMeshItems.Add(component.itemProperties); MattyFixes.Log.LogWarning((object)(component.itemProperties.itemName + " Added to the ignored Meshes!")); } } catch (Exception ex) { MattyFixes.Log.LogError((object)ex); } } [HarmonyPrefix] [HarmonyPatch(typeof(StormyWeather), "LightningStrike")] private static void ResetMeshes(StormyWeather __instance, bool useTargetedObject) { if (!((Object)(object)__instance.setStaticToObject == (Object)null) && useTargetedObject) { if (MattyFixes.PluginConfig.ReadableMeshes.Enabled.Value) { ApplyMeshMap(__instance.setStaticToObject, ReverseMeshMap); } ReverseMeshMap.Clear(); } } [HarmonyPostfix] [HarmonyPatch(typeof(StormyWeather), "Update")] private static void SetCorrectParticlePosition(StormyWeather __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance.setStaticToObject == (Object)null) && MattyFixes.PluginConfig.LightingParticle.Enabled.Value) { Transform transform = ((Component)__instance.staticElectricityParticle).transform; transform.position += _staticElectricityParticleOffset; } } } private static readonly HashSet<Item> ComputedItems = new HashSet<Item>(); private static readonly Dictionary<Mesh, Mesh> ReadableMeshMap = new Dictionary<Mesh, Mesh>(); private static readonly HashSet<Item> BrokenMeshItems = new HashSet<Item>(); private static readonly Dictionary<MeshFilter, Mesh> ReverseMeshMap = new Dictionary<MeshFilter, Mesh>(); private static Vector3 _staticElectricityParticleOffset; private static readonly Dictionary<string, List<float>> ItemRotations = new Dictionary<string, List<float>> { { "Flashlight", new List<float>(3) { 90f, 0f, 90f } }, { "Jetpack", new List<float>(3) { 45f, 0f, 0f } }, { "Key", new List<float>(3) { 180f, 0f, 90f } }, { "Apparatus", new List<float>(3) { 0f, 0f, 135f } }, { "Pro-flashlight", new List<float>(3) { 90f, 0f, 90f } }, { "Shovel", new List<float>(3) { 0f, -90f, -90f } }, { "Stun grenade", new List<float>(3) { 0f, 0f, 90f } }, { "Extension ladder", new List<float>(3) { 0f, 0f, 0f } }, { "TZP-Inhalant", new List<float>(3) { 0f, 0f, -90f } }, { "Zap gun", new List<float>(3) { 95f, 0f, 90f } }, { "Magic 7 ball", new List<float>(3) { 0f, 0f, 0f } }, { "Airhorn", new List<float>(3) { 0f, 90f, 270f } }, { "Big bolt", new List<float>(3) { -21f, 0f, 0f } }, { "Bottles", new List<float>(3) { -90f, 0f, 0f } }, { "Brush", new List<float>(3) { 90f, 0f, 0f } }, { "Candy", new List<float>(3) { 90f, 0f, 0f } }, { "Chemical jug", new List<float>(3) { -90f, 0f, 0f } }, { "Clown horn", new List<float>(3) { -90f, 0f, 0f } }, { "Large axle", new List<float>(3) { 7f, 0f, 0f } }, { "Teeth", new List<float>(3) { -90f, 0f, 0f } }, { "V-type engine", new List<float>(3) { -90f, 0f, 0f } }, { "Plastic fish", new List<float>(3) { -45f, 0f, 90f } }, { "Laser pointer", new List<float>(3) { 0f, 0f, 0f } }, { "Gold bar", new List<float>(3) { -90f, 0f, -90f } }, { "Magnifying glass", new List<float>(3) { 0f, 90f, -90f } }, { "Cookie mold pan", new List<float>(3) { -90f, 0f, 90f } }, { "Mug", new List<float>(3) { -90f, 0f, 0f } }, { "Perfume bottle", new List<float>(3) { -90f, 0f, 0f } }, { "Old phone", new List<float>(3) { -90f, 0f, -90f } }, { "Jar of pickles", new List<float>(3) { -90f, 0f, 0f } }, { "Pill bottle", new List<float>(3) { -90f, 0f, 0f } }, { "Ring", new List<float>(3) { 0f, -90f, 90f } }, { "Toy robot", new List<float>(3) { -90f, 0f, 0f } }, { "Rubber Ducky", new List<float>(3) { -90f, 0f, -90f } }, { "Steering wheel", new List<float>(3) { -90f, 0f, 0f } }, { "Toothpaste", new List<float>(3) { -90f, 0f, 0f } }, { "Hive", new List<float>(3) { 7f, 0f, 0f } }, { "Radar-booster", new List<float>(3) { 0f, 0f, 0f } }, { "Shotgun", new List<float>(3) { 180f, 0f, -5f } }, { "Ammo", new List<float>(3) { 0f, 0f, 90f } }, { "Spray paint", new List<float>(3) { 0f, 0f, 195f } }, { "Homemade flashbang", new List<float>(3) { 0f, 0f, 90f } }, { "Gift", new List<float>(3) { -90f, 0f, 0f } }, { "Flask", new List<float>(3) { 25f, 0f, 0f } }, { "Tragedy", new List<float>(3) { -90f, 0f, 0f } }, { "Comedy", new List<float>(3) { -90f, 0f, 0f } }, { "Whoopie cushion", new List<float>(3) { -90f, 0f, 0f } } }; internal static Vector3 FixPlacement(Vector3 hitPoint, Transform shelfTransform, GrabbableObject heldObject) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) Renderer component = ((Component)shelfTransform).gameObject.GetComponent<Renderer>(); Bounds? val = ((component != null) ? new Bounds?(component.bounds) : null); float num; if (!val.HasValue) { num = shelfTransform.localScale.z / 2f; } else { Bounds value = val.Value; num = ((Bounds)(ref value)).extents.y; } float num2 = num; hitPoint.y = shelfTransform.position.y + num2 + heldObject.itemProperties.verticalOffset; return hitPoint; } [HarmonyPrefix] [HarmonyPatch(typeof(PlaceableObjectsSurface), "itemPlacementPosition")] private static bool ItemPlacementPositionPatch(PlaceableObjectsSurface __instance, ref Vector3 __result, Transform gameplayCamera, GrabbableObject heldObject) { //IL_003f: 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_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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (!MattyFixes.PluginConfig.ItemClipping.Enabled.Value) { return true; } Transform parent = ((Component)__instance).transform.parent.parent; GameObject gameObject = CupBoardFix.Closet.gameObject; if ((Object)(object)parent != (Object)(object)((gameObject != null) ? gameObject.transform : null)) { return true; } try { RaycastHit val = default(RaycastHit); if (Physics.Raycast(gameplayCamera.position, gameplayCamera.forward, ref val, 7f, 1073744640, (QueryTriggerInteraction)1)) { Vector3 hitPoint = __instance.placeableBounds.ClosestPoint(((RaycastHit)(ref val)).point); __result = FixPlacement(hitPoint, ((Component)__instance).transform, heldObject); return false; } __result = Vector3.zero; return false; } catch (Exception arg) { MattyFixes.Log.LogError((object)$"Exception while finding the Cupboard Placement {arg}"); return true; } } private static void UpdateItemRotation(string modName, Item item) { //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e3: 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_01b5: Unknown result type (might be due to invalid IL or missing references) if (!MattyFixes.PluginConfig.ItemClipping.ItemRotations.TryGetValue(item, out var value)) { Vector3 restingRotation = item.restingRotation; restingRotation.y = item.floorYOffset; string text = restingRotation.x.ToString(CultureInfo.InvariantCulture) + "," + restingRotation.y.ToString(CultureInfo.InvariantCulture) + "," + restingRotation.z.ToString(CultureInfo.InvariantCulture); string text2 = Regex.Replace(modName, "[\\n\\t\\\\\\'\\[\\]]", "").Trim(); string text3 = Regex.Replace(item.itemName, "[\\n\\t\\\\\\'\\[\\]]", "").Trim(); value = new MattyFixes.ItemRotationConfig(restingRotation, ((BaseUnityPlugin)MattyFixes.Instance).Config.Bind<string>("ItemClipping.Rotations|" + text2, text3, "default", "Comma separated Vector3 rotation\nvanilla default = '" + text + "'")); MattyFixes.PluginConfig.ItemClipping.ItemRotations[item] = value; value.Config.SettingChanged += delegate { UpdateItemRotation(modName, item); }; if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddConfig(value.Config); } } Vector3 original = value.Original; string[] array = value.Config.Value.Split(","); if (array.Length == 3) { ((Vector3)(ref original))..ctor(float.Parse(array[0], CultureInfo.InvariantCulture), float.Parse(array[1], CultureInfo.InvariantCulture), float.Parse(array[2], CultureInfo.InvariantCulture)); } item.restingRotation = original; item.floorYOffset = (int)Math.Round(item.restingRotation.y); } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPriority(0)] private static void RegisterItems(StartOfRound __instance, bool __runOriginal) { //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) if (!MattyFixes.PluginConfig.ItemClipping.Enabled.Value || !__runOriginal) { return; } Dictionary<Item, string> items = default(Dictionary<Item, string>); PooledObject<Dictionary<Item, string>> val = CollectionPool<Dictionary<Item, string>, KeyValuePair<Item, string>>.Get(ref items); try { if (LethalLibProxy.Enabled) { LethalLibProxy.GetModdedItems(in items); } if (LethalLevelLoaderProxy.Enabled) { LethalLevelLoaderProxy.GetModdedItems(in items); } foreach (Item items2 in __instance.allItemsList.itemsList) { items.TryAdd(items2, "Vanilla"); } foreach (var (val3, text2) in items) { try { if (!((Object)(object)val3.spawnPrefab == (Object)null)) { val3.spawnPrefab.transform.CacheChildVertexes(); if (ItemRotations.TryGetValue(val3.itemName, out var value)) { ((Vector3)(ref val3.restingRotation)).Set(value[0], value[1], value[2]); } UpdateItemRotation(text2, val3); } } catch (Exception ex) { MattyFixes.Log.LogError((object)string.Format("{0}{1}{2} crashed badly ! {3}", text2, (text2 != null) ? "." : "", val3.itemName, ex)); } } } finally { ((IDisposable)val).Dispose(); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "LoadUnlockables")] private static void CorrectlyPlaceAllUnlockables(StartOfRound __instance) { if (MattyFixes.PluginConfig.ItemClipping.Enabled.Value) { AutoParentToShip[] array = Object.FindObjectsOfType<AutoParentToShip>(); foreach (AutoParentToShip val in array) { val.MoveToOffset(); } Physics.SyncTransforms(); } } private static void MakeMeshReadable(GameObject go, bool updateOriginal = false, Dictionary<MeshFilter, Mesh> reverseMap = null) { MeshFilter component = go.GetComponent<MeshFilter>(); MeshFilter[] array = (MeshFilter[])((component == null) ? ((Array)go.GetComponentsInChildren<MeshFilter>()) : ((Array)new MeshFilter[1] { component })); MeshFilter[] array2 = array; foreach (MeshFilter val in array2) { Mesh sharedMesh = val.sharedMesh; if (!sharedMesh.isReadable) { if (!ReadableMeshMap.TryGetValue(sharedMesh, out var value)) { value = MakeReadableMeshCopy(sharedMesh); } ReadableMeshMap[sharedMesh] = value; if (updateOriginal) { val.sharedMesh = value; } if (reverseMap != null) { reverseMap[val] = sharedMesh; } } } } private static void ApplyMeshMap(GameObject go, Dictionary<MeshFilter, Mesh> meshMap) { MeshFilter component = go.GetComponent<MeshFilter>(); MeshFilter[] array = (MeshFilter[])((component == null) ? ((Array)go.GetComponentsInChildren<MeshFilter>()) : ((Array)new MeshFilter[1] { component })); MeshFilter[] array2 = array; foreach (MeshFilter val in array2) { if (meshMap.TryGetValue(val, out var value)) { val.sharedMesh = value; } } } private static Mesh MakeReadableMeshCopy(Mesh nonReadableMesh) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) Mesh val = new Mesh(); val.indexFormat = nonReadableMesh.indexFormat; nonReadableMesh.vertexBufferTarget = (Target)1; if (nonReadableMesh.vertexBufferCount > 0) { GraphicsBuffer vertexBuffer = nonReadableMesh.GetVertexBuffer(0); int num = vertexBuffer.stride * vertexBuffer.count; byte[] array = new byte[num]; vertexBuffer.GetData((Array)array); val.SetVertexBufferParams(nonReadableMesh.vertexCount, nonReadableMesh.GetVertexAttributes()); val.SetVertexBufferData<byte>(array, 0, 0, num, 0, (MeshUpdateFlags)0); vertexBuffer.Release(); } nonReadableMesh.indexBufferTarget = (Target)2; val.subMeshCount = nonReadableMesh.subMeshCount; GraphicsBuffer indexBuffer = nonReadableMesh.GetIndexBuffer(); int num2 = indexBuffer.stride * indexBuffer.count; byte[] array2 = new byte[num2]; indexBuffer.GetData((Array)array2); val.SetIndexBufferParams(indexBuffer.count, nonReadableMesh.indexFormat); val.SetIndexBufferData<byte>(array2, 0, 0, num2, (MeshUpdateFlags)0); indexBuffer.Release(); uint num3 = 0u; for (int i = 0; i < val.subMeshCount; i++) { uint indexCount = nonReadableMesh.GetIndexCount(i); val.SetSubMesh(i, new SubMeshDescriptor((int)num3, (int)indexCount, (MeshTopology)0), (MeshUpdateFlags)0); num3 += indexCount; } val.RecalculateNormals(); val.RecalculateBounds(); ((Object)val).name = "Readable " + ((Object)nonReadableMesh).name; return val; } } [HarmonyPatch] internal class NamePatches { private static readonly Dictionary<ulong, Coroutine> NameCoroutines = new Dictionary<ulong, Coroutine>(); [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "SendNewPlayerValuesClientRpc")] [HarmonyPriority(800)] private static void PatchNames(PlayerControllerB __instance, ulong[] playerSteamIds) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 if (!MattyFixes.PluginConfig.NameFixes.Enabled.Value) { return; } NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening || ((int)((NetworkBehaviour)__instance).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) || (int)((NetworkBehaviour)__instance).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } StartOfRound instance = StartOfRound.Instance; for (int i = 0; i < playerSteamIds.Length; i++) { PlayerControllerB val = __instance.playersManager.allPlayerScripts[i]; ulong num = playerSteamIds[i]; if (val.isPlayerControlled || val.isPlayerDead) { if (NameCoroutines.TryGetValue(num, out var value)) { ((MonoBehaviour)instance).StopCoroutine(value); } NameCoroutines[num] = ((MonoBehaviour)instance).StartCoroutine(LateUsernameUpdate(val, i, num)); } } } private static IEnumerator LateUsernameUpdate(PlayerControllerB _controller, int index, ulong steamID) { yield return (object)new WaitUntil((Func<bool>)(() => !SteamFriends.RequestUserInformation(SteamId.op_Implicit(steamID), false))); Friend val = default(Friend); ((Friend)(ref val))..ctor(SteamId.op_Implicit(steamID)); string name = ((Friend)(ref val)).Name; MattyFixes.Log.LogWarning((object)$"Late Friend update Completed Player {index} ({steamID}) has name {name}"); name = Regex.Replace(_controller.NoPunctuation(name), "[^\\w\\._]", ""); if (name == string.Empty || name.Length == 0) { name = "Nameless"; } else if (name.Length <= 2) { name += "0"; } _controller.playerSteamId = steamID; _controller.playerUsername = name; ((TMP_Text)_controller.usernameBillboardText).text = name; int numberOfDuplicateNamesInLobby = _controller.GetNumberOfDuplicateNamesInLobby(); if (numberOfDuplicateNamesInLobby > 0) { name = $"{name}{numberOfDuplicateNamesInLobby}"; } _controller.quickMenuManager.AddUserToPlayerList(steamID, name, index); StartOfRound.Instance.mapScreen.ChangeNameOfTargetTransform(((Component)_controller).transform, name); if (HUDManager.Instance.spectatingPlayerBoxes.ContainsValue(_controller)) { GameObject gameObject = ((Component)HUDManager.Instance.spectatingPlayerBoxes.First((KeyValuePair<Animator, PlayerControllerB> x) => (Object)(object)x.Value == (Object)(object)_controller).Key).gameObject; ((TMP_Text)gameObject.GetComponentInChildren<TextMeshProUGUI>()).text = name; if (!GameNetworkManager.Instance.disableSteam) { HUDManager.FillImageWithSteamProfile(gameObject.GetComponent<RawImage>(), SteamId.op_Implicit(_controller.playerSteamId), true); } } NameCoroutines.Remove(steamID); } } [HarmonyPatch] internal class OutOfBoundsItemsFix { [HarmonyPostfix] [HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")] private static void ShipLeave(RoundManager __instance, bool despawnAllItems) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: 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_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) if (!MattyFixes.PluginConfig.OutOfBounds.Enabled.Value) { return; } MattyFixes.VerboseItemsLog((LogLevel)16, () => "Ship left the planet: starting check for OOB items!"); Transform elevatorTransform = StartOfRound.Instance.elevatorTransform; GrabbableObject[] componentsInChildren = ((Component)elevatorTransform).GetComponentsInChildren<GrabbableObject>(); Collider shipInnerRoomBounds = StartOfRound.Instance.shipInnerRoomBounds; BoxCollider vehicleCollider = Object.FindObjectOfType<VehicleController>()?.boundsCollider; MattyFixes.VerboseItemsLog((LogLevel)32, () => $"Cruiser? {(Object)(object)vehicleCollider != (Object)null}"); Bounds bounds; float num; if (!((Object)(object)vehicleCollider == (Object)null)) { bounds = shipInnerRoomBounds.bounds; float y = ((Bounds)(ref bounds)).min.y; bounds = ((Collider)vehicleCollider).bounds; num = Math.Min(y, ((Bounds)(ref bounds)).min.y); } else { bounds = shipInnerRoomBounds.bounds; num = ((Bounds)(ref bounds)).min.y; } float miny = num; MattyFixes.VerboseItemsLog((LogLevel)32, () => $"Bottom Ship is at y? {miny}"); GrabbableObject[] array = componentsInChildren; foreach (GrabbableObject item in array) { if ((Object)(object)((Component)((NetworkBehaviour)item).NetworkObject).transform.parent != (Object)(object)elevatorTransform) { MattyFixes.VerboseItemsLog((LogLevel)32, () => $"{item.itemProperties.itemName}({((NetworkBehaviour)item).NetworkObjectId}) was not parented to the ship. SKIPPING!"); continue; } MattyFixes.VerboseItemsLog((LogLevel)32, () => $"{item.itemProperties.itemName}({((NetworkBehaviour)item).NetworkObjectId}) in ship room? {item.isInShipRoom}"); if (!item.isInShipRoom) { continue; } Transform transform = ((Component)item).transform; MattyFixes.VerboseItemsLog((LogLevel)32, () => $"{item.itemProperties.itemName}({((NetworkBehaviour)item).NetworkObjectId}) y position? {transform.position.y}"); if (!(transform.position.y >= miny)) { MattyFixes.VerboseItemsLog((LogLevel)16, () => $"{item.itemProperties.itemName}({((NetworkBehaviour)item).NetworkObjectId}) was found OutOfBounds, teleporting inside!"); Transform obj = transform; bounds = shipInnerRoomBounds.bounds; obj.position = ((Bounds)(ref bounds)).center; item.targetFloorPosition = transform.localPosition; item.FallToGround(false); MattyFixes.VerboseItemsLog((LogLevel)32, () => $"{item.itemProperties.itemName}({((NetworkBehaviour)item).NetworkObjectId}) new pos: {item.targetFloorPosition}"); } } } [HarmonyTranspiler] [HarmonyPatch(typeof(GameNetworkManager), "SaveItemsInShip")] private static IEnumerable<CodeInstruction> SaveItemsCorrectly(IEnumerable<CodeInstruction> instructions, ILGenerator ilGenerator) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); MethodInfo methodInfo = AccessTools.Method(typeof(OutOfBoundsItemsFix), "ApplyVerticalOffset", (Type[])null, (Type[])null); MethodInfo getMethod = AccessTools.Property(typeof(Component), "transform").GetMethod; MethodInfo getMethod2 = AccessTools.Property(typeof(Transform), "position").GetMethod; CodeMatcher val = new CodeMatcher((IEnumerable<CodeInstruction>)list, ilGenerator); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[6] { new CodeMatch((OpCode?)OpCodes.Ldloc_2, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldelem_Ref, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)getMethod, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)getMethod2, (string)null) }); if (val.IsInvalid) { MattyFixes.Log.LogError((object)"Cannot patch SaveItemsInShip"); MattyFixes.Log.LogDebug((object)string.Join("\n", list)); return list; } val.Advance(4); val.Insert((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Dup, (object)null) }); val.Advance(3); val.Insert((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)methodInfo) }); MattyFixes.Log.LogDebug((object)"SaveItemsInShip Patched"); return val.Instructions(); } private static Vector3 ApplyVerticalOffset(GrabbableObject grabbable, Vector3 position) { //IL_000e: 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_0021: 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_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_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_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_0087: 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_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_00ac: 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) if (!MattyFixes.PluginConfig.OutOfBounds.Enabled.Value) { return position; } if (grabbable.isHeld || grabbable.isHeldByEnemy || !grabbable.hasHitGround) { return position; } Vector3 newPos = position; newPos += Vector3.down * grabbable.itemProperties.verticalOffset; newPos += Vector3.up * MattyFixes.PluginConfig.OutOfBounds.VerticalOffset.Value; MattyFixes.VerboseItemsLog((LogLevel)32, () => $"{grabbable.itemProperties.itemName}({((NetworkBehaviour)grabbable).NetworkObjectId}) fixing saved position pos:{position} newpos:{newPos}"); return newPos; } } [HarmonyPatch] internal class PlayerLevelPatch { [HarmonyTranspiler] [HarmonyPatch(typeof(HUDManager), "SyncAllPlayerLevelsClientRpc", new Type[] { typeof(int[]), typeof(int) })] private static IEnumerable<CodeInstruction> AlwaysUpdateLocalPlayer(IEnumerable<CodeInstruction> instructions) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown if (!MattyFixes.PluginConfig.BadgeFixes.Enabled.Value) { return instructions; } List<CodeInstruction> list = instructions.ToList(); FieldInfo field = typeof(GameNetworkManager).GetField("localPlayerController"); Label? label = default(Label?); for (int i = 0; i < list.Count; i++) { CodeInstruction val = list[i]; if (CodeInstructionExtensions.LoadsField(val, field, false) && CodeInstructionExtensions.Branches(list[i + 2], ref label)) { for (int j = i - 5; j < i + 2; j++) { list[j] = new CodeInstruction(OpCodes.Nop, (object)null) { labels = list[j].labels, blocks = list[j].blocks }; } list[i + 2] = new CodeInstruction(OpCodes.Br, (object)label) { labels = list[i + 2].labels, blocks = list[i + 2].blocks }; MattyFixes.Log.LogDebug((object)"SyncAllPlayerLevelsClientRpc patched!"); break; } } return list; } } [HarmonyPatch] internal class RadarPatch { [HarmonyPatch] internal class ItemInShipPatch { [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "LateUpdate")] [HarmonyPriority(0)] private static void UpdatePatch(GrabbableObject __instance, bool __runOriginal) { if (__runOriginal && MattyFixes.PluginConfig.Radar.RemoveOnShip.Value && __instance.isInShipRoom && (Object)(object)__instance.radarIcon != (Object)null) { Object.Destroy((Object)(object)((Component)__instance.radarIcon).gameObject); } } } [HarmonyPatch] internal class DeletedObjectPatch { [HarmonyPrefix] [HarmonyPatch(typeof(NetworkBehaviour), "OnDestroy")] private static void DestroyPatch(NetworkBehaviour __instance) { if (MattyFixes.PluginConfig.Radar.Enabled.Value && MattyFixes.PluginConfig.Radar.RemoveDeleted.Value) { GrabbableObject val = (GrabbableObject)(object)((__instance is GrabbableObject) ? __instance : null); if ((Object)(object)val != (Object)null && (Object)(object)val.radarIcon != (Object)null && (Object)(object)((Component)val.radarIcon).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)val.radarIcon).gameObject); } } } } } [HarmonyPatch] internal class StartOfRoundPatch { internal static bool _isInitializingGame; [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "Start")] private static void MarkServerStart(StartOfRound __instance) { _isInitializingGame = true; ((MonoBehaviour)__instance).StartCoroutine(WaitCoupleOfFrames()); } private static IEnumerator WaitCoupleOfFrames() { yield return (object)new WaitForEndOfFrame(); yield return (object)new WaitForEndOfFrame(); yield return (object)new WaitForEndOfFrame(); _isInitializingGame = false; } } } namespace MattyFixes.Dependency { public static class LethalConfigProxy { [Serializable] [CompilerGenerated] private sealed class <>c__7<T> where T : Enum { public static readonly <>c__7<T> <>9 = new <>c__7<T>(); public static CanModifyDelegate <>9__7_0; internal CanModifyResult <AddConfig>b__7_0() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return CanModifyResult.op_Implicit((false, "THIS IS A FLAG TYPE ENUM, EDITING CURRENTLY NOT SUPPORTED!")); } } private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); _enabled = valueOrDefault; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfig(ConfigEntry<string> entry, bool requiresRestart = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(entry, new TextInputFieldOptions { RequiresRestart = requiresRestart, Name = GetPrettyConfigName<string>(entry) })); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfig(ConfigEntry<bool> entry, bool requiresRestart = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(entry, new BoolCheckBoxOptions { RequiresRestart = requiresRestart, Name = GetPrettyConfigName<bool>(entry) })); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfig(ConfigEntry<float> entry, bool requiresRestart = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: