Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of InteriorNavMeshFixer v0.0.3
NoteBoxz.InteriorNavMeshFixer.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Adapters; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.AI.Navigation; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("NoteBoxz.InteriorNavMeshFixer")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.0.3.0")] [assembly: AssemblyInformationalVersion("0.0.3")] [assembly: AssemblyProduct("InteriorNavMeshFixer")] [assembly: AssemblyTitle("NoteBoxz.InteriorNavMeshFixer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.3.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 InteriorNavMeshFixer { [BepInPlugin("NoteBoxz.InteriorNavMeshFixer", "InteriorNavMeshFixer", "0.0.3")] public class InteriorNavMeshFixer : BaseUnityPlugin { public static InteriorNavMeshFixer Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } public static ConfigEntry<NavMeshCollectGeometry> NavMeshCollectGeometry { get; private set; } public static ConfigEntry<int> NavMeshLayerMask { get; private set; } public static ConfigEntry<float> NavMeshVoxelSize { get; private set; } public static ConfigEntry<float> NavMeshMinRegionArea { get; private set; } public static ConfigEntry<int> NavMeshTileSize { get; private set; } public static ConfigEntry<bool> DontFixVanilaInteriors { get; private set; } public static ConfigEntry<bool> ReplaceNavMesh { get; private set; } public static ConfigEntry<bool> AddLinksToInteriorLadders { get; private set; } public static ConfigEntry<bool> DebugShowNavMesh { get; private set; } public static ConfigEntry<bool> DebugShowOffMeshLinks { get; private set; } public static ConfigEntry<bool> DebugShowNavLinks { get; private set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Patch(); BindConfigs(); Logger.LogInfo((object)"NoteBoxz.InteriorNavMeshFixer v0.0.3 has loaded!"); } internal static void BindConfigs() { NavMeshLayerMask = ((BaseUnityPlugin)Instance).Config.Bind<int>("NavMesh", "NavMesh LayerMask", -620720807, "Layer mask for NavMesh generation."); NavMeshCollectGeometry = ((BaseUnityPlugin)Instance).Config.Bind<NavMeshCollectGeometry>("NavMesh", "NavMesh Collect Geometry", (NavMeshCollectGeometry)1, "Geometry to use for NavMesh generation."); NavMeshVoxelSize = ((BaseUnityPlugin)Instance).Config.Bind<float>("NavMesh", "NavMesh Voxel Size", 0.1666667f, "Voxel size for NavMesh generation."); NavMeshTileSize = ((BaseUnityPlugin)Instance).Config.Bind<int>("NavMesh", "NavMesh Tile Size", 256, "Tile size for NavMesh generation."); NavMeshMinRegionArea = ((BaseUnityPlugin)Instance).Config.Bind<float>("NavMesh", "NavMesh Min Region Area", 2f, "Minimum region area for NavMesh generation."); ReplaceNavMesh = ((BaseUnityPlugin)Instance).Config.Bind<bool>("NavMesh", "Replace NavMesh", true, "Replace existing NavMesh with a new one, if false then the mod won't do anything to the navmesh."); AddLinksToInteriorLadders = ((BaseUnityPlugin)Instance).Config.Bind<bool>("NavMesh", "Add Links To Interior Ladders", true, "Add Nav Links to interior ladders."); DontFixVanilaInteriors = ((BaseUnityPlugin)Instance).Config.Bind<bool>("NavMesh", "Dont Fix Vanila Interiors", true, "Don't attempt to fix vanilla interiors. Only affects interiors added by mods."); DebugShowNavMesh = ((BaseUnityPlugin)Instance).Config.Bind<bool>("Debug", "Debug Show NavMesh", false, "Show NavMesh visualization in-game."); DebugShowOffMeshLinks = ((BaseUnityPlugin)Instance).Config.Bind<bool>("Debug", "Debug Show OffMeshLinks", false, "Show Off-Mesh Links visualization in-game. (represented by cubes, if both cubes are yellow that means enemies can use it both ways, if one cube is red that means it's one-way)"); DebugShowNavLinks = ((BaseUnityPlugin)Instance).Config.Bind<bool>("Debug", "Debug Show NavLinks", false, "Show Nav Links visualization in-game. (represented by spheres, if both spheres are green that means enemies can use it both ways, if one sphere is red that means it's one-way)"); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("NoteBoxz.InteriorNavMeshFixer"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public class RuntimeNavLinkViewer : MonoBehaviour { public NavMeshLink Link = null; private GameObject startCube = null; private GameObject endCube = null; private LineRenderer lineRenderer = null; [Range(2f, 32f)] public int curveResolution = 16; private void Start() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Link != (Object)null) { startCube = Utils.CreateDebugObject((PrimitiveType)0, Link.startPoint, Color.green); startCube.transform.SetParent(((Component)this).transform); endCube = Utils.CreateDebugObject((PrimitiveType)0, Link.endPoint, Link.bidirectional ? Color.green : Color.red); endCube.transform.SetParent(((Component)this).transform); lineRenderer = ((Component)this).gameObject.AddComponent<LineRenderer>(); lineRenderer.positionCount = curveResolution; ((Renderer)lineRenderer).material = new Material(Shader.Find("HDRP/Unlit")); lineRenderer.widthMultiplier = Link.width; lineRenderer.startColor = Color.green; lineRenderer.endColor = Color.red; } } private void Update() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Link != (Object)null)) { return; } if ((Object)(object)startCube != (Object)null) { startCube.transform.position = ((Component)Link).transform.TransformPoint(Link.startPoint); } if ((Object)(object)endCube != (Object)null) { endCube.transform.position = ((Component)Link).transform.TransformPoint(Link.endPoint); } if ((Object)(object)lineRenderer != (Object)null) { Vector3 val = ((Component)Link).transform.TransformPoint(Link.startPoint); Vector3 val2 = ((Component)Link).transform.TransformPoint(Link.endPoint); Vector3 val3 = (val + val2) * 0.5f + Vector3.up * 1f; for (int i = 0; i < curveResolution; i++) { float num = (float)i / (float)(curveResolution - 1); Vector3 val4 = Mathf.Pow(1f - num, 2f) * val + 2f * (1f - num) * num * val3 + Mathf.Pow(num, 2f) * val2; lineRenderer.SetPosition(i, val4); } } } } public class RuntimeNavViewer : MonoBehaviour { private GameObject Visualizer = null; public Material meshMaterial = null; public static RuntimeNavViewer Instance { get; private set; } public void Awake() { Instance = this; } private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_005a: 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) Visualizer = new GameObject("NavMeshVisualizer"); Visualizer.AddComponent<MeshFilter>(); Visualizer.AddComponent<MeshRenderer>(); Visualizer.transform.SetParent(((Component)this).transform); Visualizer.transform.localPosition = new Vector3(0f, 0.1f, 0f); Visualizer.transform.localRotation = Quaternion.identity; GenerateNavMeshVisualization(); } public void GenerateNavMeshVisualization() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) ClearNavMeshVisualization(); Visualizer.SetActive(InteriorNavMeshFixer.DebugShowNavMesh.Value); NavMeshTriangulation val = NavMesh.CalculateTriangulation(); Mesh val2 = new Mesh(); val2.vertices = val.vertices; val2.triangles = val.indices; val2.RecalculateNormals(); MeshFilter component = Visualizer.GetComponent<MeshFilter>(); component.mesh = val2; MeshRenderer component2 = Visualizer.GetComponent<MeshRenderer>(); if ((Object)(object)meshMaterial != (Object)null) { ((Renderer)component2).material = meshMaterial; } else { Shader val3 = Shader.Find("HDRP/Lit"); if ((Object)(object)val3 != (Object)null) { ((Renderer)component2).material = new Material(val3); } else { Debug.LogWarning((object)"HDRP/Lit shader not found. Please assign an HDRP material manually."); } } ((Renderer)component2).material.color = new Color(0f, 1f, 1f, 0.3f); NavMeshLink[] array = Object.FindObjectsByType<NavMeshLink>((FindObjectsSortMode)0); foreach (NavMeshLink val4 in array) { if (!InteriorNavMeshFixer.DebugShowNavLinks.Value) { break; } RuntimeNavLinkViewer runtimeNavLinkViewer = new GameObject(((Object)((Component)val4).gameObject).name + "_NavLinkViewer").AddComponent<RuntimeNavLinkViewer>(); runtimeNavLinkViewer.Link = val4; ((Component)runtimeNavLinkViewer).transform.SetParent(((Component)this).transform); } OffMeshLink[] array2 = Object.FindObjectsByType<OffMeshLink>((FindObjectsSortMode)0); foreach (OffMeshLink val5 in array2) { if (!InteriorNavMeshFixer.DebugShowOffMeshLinks.Value) { break; } RuntimeOffMeshViewer runtimeOffMeshViewer = new GameObject(((Object)((Component)val5).gameObject).name + "_OffMeshLinkViewer").AddComponent<RuntimeOffMeshViewer>(); runtimeOffMeshViewer.Link = val5; ((Component)runtimeOffMeshViewer).transform.SetParent(((Component)this).transform); } } public void ClearNavMeshVisualization() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown MeshFilter component = Visualizer.GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null) { component.mesh = null; } foreach (Transform item in ((Component)this).transform) { Transform val = item; if (((Object)val).name.EndsWith("NavLinkViewer") || ((Object)val).name.EndsWith("OffMeshLinkViewer")) { Object.Destroy((Object)(object)((Component)val).gameObject); } } } public string ParseLayerMask(int layerMask) { string[] array = new string[32]; for (int i = 0; i < 32; i++) { if ((layerMask & (1 << i)) != 0) { array[i] = LayerMask.LayerToName(i); } } return string.Join(", ", array); } } public class RuntimeOffMeshViewer : MonoBehaviour { public OffMeshLink Link = null; private GameObject startCube = null; private GameObject endCube = null; private LineRenderer lineRenderer = null; [Range(2f, 32f)] public int curveResolution = 16; private void Start() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_0112: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Link.startTransform == (Object)null || (Object)(object)Link.endTransform == (Object)null) { Debug.LogError((object)"OffMeshLink does not have a startTransform assigned."); } else if ((Object)(object)Link != (Object)null) { startCube = Utils.CreateDebugObject((PrimitiveType)3, Link.startTransform.position, Color.green); startCube.transform.SetParent(((Component)this).transform); endCube = Utils.CreateDebugObject((PrimitiveType)3, Link.endTransform.position, Link.biDirectional ? Color.green : Color.red); endCube.transform.SetParent(((Component)this).transform); lineRenderer = ((Component)this).gameObject.AddComponent<LineRenderer>(); lineRenderer.positionCount = curveResolution; ((Renderer)lineRenderer).material = new Material(Shader.Find("HDRP/Unlit")); lineRenderer.widthMultiplier = 0.1f; lineRenderer.startColor = Color.yellow; lineRenderer.endColor = Color.blue; } } private void Update() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Link != (Object)null)) { return; } if ((Object)(object)startCube != (Object)null) { startCube.transform.position = Link.startTransform.position; } if ((Object)(object)endCube != (Object)null) { endCube.transform.position = Link.endTransform.position; } if ((Object)(object)lineRenderer != (Object)null) { Vector3 position = Link.startTransform.position; Vector3 position2 = Link.endTransform.position; Vector3 val = (position + position2) * 0.5f + Vector3.up * 1f; for (int i = 0; i < curveResolution; i++) { float num = (float)i / (float)(curveResolution - 1); Vector3 val2 = Mathf.Pow(1f - num, 2f) * position + 2f * (1f - num) * num * val + Mathf.Pow(num, 2f) * position2; lineRenderer.SetPosition(i, val2); } } } } public static class Utils { public static GameObject CreateDebugObject(PrimitiveType type, Vector3 Position, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_005e: 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_0078: 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) GameObject val = GameObject.CreatePrimitive(type); val.GetComponent<Collider>().enabled = false; Shader val2 = Shader.Find("HDRP/Lit"); if ((Object)(object)val2 != (Object)null) { val.gameObject.GetComponent<Renderer>().material = new Material(val2); } else { Debug.LogWarning((object)"HDRP/Lit shader not found. Please assign an HDRP material manually."); } val.GetComponent<Renderer>().material.color = color; val.transform.position = Position; val.transform.localScale = Vector3.one * 0.5f; return val; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "NoteBoxz.InteriorNavMeshFixer"; public const string PLUGIN_NAME = "InteriorNavMeshFixer"; public const string PLUGIN_VERSION = "0.0.3"; } } namespace InteriorNavMeshFixer.Patches { [HarmonyPatch(typeof(RoundManager))] public class RoundManagerPatch { private static NavMeshSurface newSurface; [HarmonyPatch("FinishGeneratingNewLevelClientRpc")] [HarmonyPrefix] private static void FinishGeneratingNewLevelClientRpcPrefix(RoundManager __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 try { if (((NetworkBehaviour)__instance).NetworkManager != null && ((NetworkBehaviour)__instance).NetworkManager.IsListening && (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2 && (((NetworkBehaviour)__instance).NetworkManager.IsClient || ((NetworkBehaviour)__instance).NetworkManager.IsHost)) { if (__instance.currentDungeonType <= 4 && InteriorNavMeshFixer.DontFixVanilaInteriors.Value) { InteriorNavMeshFixer.Logger.LogMessage((object)$"Skipping NavMesh regeneration for vanilla dungeon type {__instance.currentDungeonType} due to config setting."); return; } RegenNav(); RuntimeNavViewer.Instance.GenerateNavMeshVisualization(); } } catch (Exception arg) { InteriorNavMeshFixer.Logger.LogError((object)$"Error in FinishGeneratingNewLevelClientRpcPrefix: {arg}"); } } public static void RegenNav() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) InteriorNavMeshFixer.Logger.LogMessage((object)$"Regenerating NavMesh ({RoundManager.Instance.currentDungeonType})..."); if (InteriorNavMeshFixer.AddLinksToInteriorLadders.Value) { InteractTrigger[] array = Object.FindObjectsOfType<InteractTrigger>(); foreach (InteractTrigger val in array) { if (val.isLadder && !(((Component)val).transform.position.y > -150f)) { GameObject val2 = new GameObject("OffMeshLink_" + ((Object)((Component)val).gameObject).name); val2.transform.SetParent(((Component)val).transform); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; OffMeshLink val3 = val2.AddComponent<OffMeshLink>(); val3.startTransform = val.bottomOfLadderPosition; val3.endTransform = val.topOfLadderPosition; val3.costOverride = -1f; val3.biDirectional = true; val3.activated = true; InteriorNavMeshFixer.Logger.LogDebug((object)("Added NavMeshLink for ladder " + ((Object)((Component)val).gameObject).name)); } } } if (InteriorNavMeshFixer.ReplaceNavMesh.Value) { UnityNavMeshAdapter val4 = Object.FindObjectOfType<UnityNavMeshAdapter>(); if ((Object)(object)val4 == (Object)null) { InteriorNavMeshFixer.Logger.LogError((object)"NavMeshAdapter not found in scene. Cannot regenerate navmesh."); return; } List<NavMeshSurface> list = new List<NavMeshSurface>(val4.fullBakeSurfaces); foreach (NavMeshSurface item in list) { try { if ((Object)(object)item != (Object)null) { InteriorNavMeshFixer.Logger.LogDebug((object)("Removing existing NavMeshSurface on " + ((Object)((Component)item).gameObject).name)); item.RemoveData(); } } catch (Exception arg) { InteriorNavMeshFixer.Logger.LogError((object)$"Error removing NavMeshSurface: {arg}"); } } if ((Object)(object)newSurface == (Object)null) { Dungeon obj = Object.FindObjectOfType<Dungeon>(); object obj2; if (obj == null) { obj2 = null; } else { Transform parent = ((Component)obj).gameObject.transform.parent; obj2 = ((parent != null) ? ((Component)parent).gameObject : null); } GameObject val5 = (GameObject)obj2; if ((Object)(object)val5 == (Object)null) { InteriorNavMeshFixer.Logger.LogError((object)"Dungeon object not found in scene. Cannot regenerate navmesh."); return; } newSurface = val5.AddComponent<NavMeshSurface>(); InteriorNavMeshFixer.Logger.LogDebug((object)("Created new NavMeshSurface on " + ((Object)val5).name)); } newSurface.collectObjects = (CollectObjects)2; newSurface.m_GenerateLinks = true; newSurface.useGeometry = InteriorNavMeshFixer.NavMeshCollectGeometry.Value; newSurface.layerMask = LayerMask.op_Implicit(InteriorNavMeshFixer.NavMeshLayerMask.Value); newSurface.minRegionArea = InteriorNavMeshFixer.NavMeshMinRegionArea.Value; if (InteriorNavMeshFixer.NavMeshTileSize != ((ConfigEntryBase)InteriorNavMeshFixer.NavMeshVoxelSize).DefaultValue) { newSurface.overrideTileSize = true; newSurface.tileSize = InteriorNavMeshFixer.NavMeshTileSize.Value; } if (InteriorNavMeshFixer.NavMeshVoxelSize != ((ConfigEntryBase)InteriorNavMeshFixer.NavMeshVoxelSize).DefaultValue) { newSurface.overrideVoxelSize = true; newSurface.voxelSize = InteriorNavMeshFixer.NavMeshVoxelSize.Value; } newSurface.BuildNavMesh(); } InteriorNavMeshFixer.Logger.LogMessage((object)("Rebuilt NavMesh on " + ((Object)((Component)newSurface).gameObject).name)); } } [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPostfix(StartOfRound __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("RuntimeNavViewer"); val.transform.position = Vector3.zero; val.transform.rotation = Quaternion.identity; RuntimeNavViewer runtimeNavViewer = val.AddComponent<RuntimeNavViewer>(); } [HarmonyPatch("EndOfGameClientRpc")] [HarmonyPostfix] private static void EndOfGameClientRpcPostfix(StartOfRound __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if (networkManager != null && networkManager.IsListening && (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { RuntimeNavViewer.Instance.ClearNavMeshVisualization(); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }