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 LethalBotsNavMeshProject v1.3.0
plugins/TRizzle-LethalBots NavMesh Project/LethalBotsNavMeshProject.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; 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 CSync.Extensions; using CSync.Lib; using HarmonyLib; using LethalBotsNavMeshProject.Helpers; using LethalBotsNavMeshProject.MoonNavMeshes; using Microsoft.CodeAnalysis; using Unity.AI.Navigation; using UnityEngine; using UnityEngine.AI; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalBotsNavMeshProject")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.3.0.0")] [assembly: AssemblyInformationalVersion("1.3.0+7f02ef744355099651fff715fea4ae1cc78c9866")] [assembly: AssemblyProduct("LethalBotsNavMeshProject")] [assembly: AssemblyTitle("LethalBotsNavMeshProject")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.0.0")] [assembly: TypeForwardedTo(typeof(AllowNullAttribute))] [assembly: TypeForwardedTo(typeof(DisallowNullAttribute))] [assembly: TypeForwardedTo(typeof(MaybeNullAttribute))] [assembly: TypeForwardedTo(typeof(MaybeNullWhenAttribute))] [assembly: TypeForwardedTo(typeof(NotNullAttribute))] [assembly: TypeForwardedTo(typeof(NotNullIfNotNullAttribute))] [assembly: TypeForwardedTo(typeof(NotNullWhenAttribute))] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 LethalBotsNavMeshProject { public class Config : SyncedConfig2<Config> { private const string ConfigSection = "Lethal Bots NavMesh Project"; private const string ConfigDebug = "Debug"; [SyncedEntryField] public SyncedEntry<bool> AutoGenerateLadderLinks; [SyncedEntryField] public SyncedEntry<bool> EnableExperimentationNav; [SyncedEntryField] public SyncedEntry<bool> EnableAssuranceNav; [SyncedEntryField] public SyncedEntry<bool> EnableVowNav; [SyncedEntryField] public SyncedEntry<bool> EnableOffenceNav; [SyncedEntryField] public SyncedEntry<bool> EnableAdamanceNav; [SyncedEntryField] public SyncedEntry<bool> EnableEmbrionNav; [SyncedEntryField] public SyncedEntry<bool> EnableArtificeNav; [SyncedEntryField] public SyncedEntry<bool> EnableTitanNav; public ConfigEntry<bool> EnableDebugLog; public Config(ConfigFile cfg) : base("T-Rizzle.LethalBotsNavMeshProject") { cfg.SaveOnConfigSet = false; AutoGenerateLadderLinks = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "Lethal Bots NavMesh Project", "Auto Generate Ladder Links", true, "Should we automatically generate NavMeshLinks for the bots on ladders found in the level. This includes ladders in interiors. \n Only bots will be able to use the newly generated links!"); EnableExperimentationNav = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "Lethal Bots NavMesh Project", "Enable Experimentation Nav Improvements", true, "If you are using a modified version of Experimentation, you may want to disable these improvements!"); EnableAssuranceNav = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "Lethal Bots NavMesh Project", "Enable Assurance Nav Improvements", true, "If you are using a modified version of Assurance, you may want to disable these improvements!"); EnableVowNav = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "Lethal Bots NavMesh Project", "Enable Vow Nav Improvements", true, "If you are using a modified version of Vow, you may want to disable these improvements!"); EnableOffenceNav = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "Lethal Bots NavMesh Project", "Enable Offence Nav Improvements", true, "If you are using a modified version of Offence, you may want to disable these improvements!"); EnableAdamanceNav = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "Lethal Bots NavMesh Project", "Enable Adamance Nav Improvements", true, "If you are using a modified version of Adamance, you may want to disable these improvements!"); EnableEmbrionNav = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "Lethal Bots NavMesh Project", "Enable Embrion Nav Improvements", true, "If you are using a modified version of Embrion, you may want to disable these improvements!"); EnableArtificeNav = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "Lethal Bots NavMesh Project", "Enable Artifice Nav Improvements", true, "If you are using a modified version of Artifice, you may want to disable these improvements!"); EnableTitanNav = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "Lethal Bots NavMesh Project", "Enable Titan Nav Improvements", true, "If you are using a modified version of Titan, you may want to disable these improvements!"); EnableDebugLog = cfg.Bind<bool>("Debug", "EnableDebugLog (Client only)", true, "Enable the debug logs used for this mod."); ClearUnusedEntries(cfg); cfg.SaveOnConfigSet = true; } private void ClearUnusedEntries(ConfigFile cfg) { PropertyInfo property = ((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(cfg, null); dictionary.Clear(); cfg.Save(); } } public static class NavMeshPrefabManager { private const string EXPERIMENTATION_MOON_SCENE_NAME = "41 Experimentation.Level1Experimentation"; private const string ASSURANCE_MOON_SCENE_NAME = "220 Assurance.Level2Assurance"; private const string VOW_MOON_SCENE_NAME = "56 Vow.Level3Vow"; private const string OFFENSE_MOON_SCENE_NAME = "21 Offense.Level7Offense"; private const string ADAMANCE_MOON_SCENE_NAME = "20 Adamance.Level10Adamance"; private const string EMBRION_MOON_SCENE_NAME = "5 Embrion.Level11Embrion"; private const string ARTIFICE_MOON_SCENE_NAME = "68 Artifice.Level9Artifice"; private const string TITAN_MOON_SCENE_NAME = "8 Titan.Level8Titan"; public static readonly Dictionary<string, MoonNavMesh> NavMeshPrefabs = new Dictionary<string, MoonNavMesh>(); private static GameObject ExperimentationNavPrefab = null; private static GameObject AssuranceNavPrefab = null; private static GameObject VowNavPrefab = null; private static GameObject OffenseNavPrefab = null; private static GameObject AdamanceNavPrefab = null; private static GameObject EmbrionNavPrefab = null; private static GameObject ArtificeNavPrefab = null; private static GameObject TitanNavPrefab = null; internal static void LoadPrefabs() { if (!ArePrefabsLoaded()) { ExperimentationNavPrefab = Plugin.ModAssets.LoadAsset<GameObject>("ExperimentationNavMesh"); AssuranceNavPrefab = Plugin.ModAssets.LoadAsset<GameObject>("AssuranceNavMesh"); VowNavPrefab = Plugin.ModAssets.LoadAsset<GameObject>("VowNavMesh"); OffenseNavPrefab = Plugin.ModAssets.LoadAsset<GameObject>("OffenseNavMesh"); AdamanceNavPrefab = Plugin.ModAssets.LoadAsset<GameObject>("AdamanceNavMesh"); EmbrionNavPrefab = Plugin.ModAssets.LoadAsset<GameObject>("EmbrionNavMesh"); ArtificeNavPrefab = Plugin.ModAssets.LoadAsset<GameObject>("ArtificeNavMesh"); TitanNavPrefab = Plugin.ModAssets.LoadAsset<GameObject>("TitanNavMesh"); } NavMeshPrefabs.Clear(); NavMeshPrefabs.TryAdd("41 Experimentation.Level1Experimentation", new ExperimentationNavMesh(ExperimentationNavPrefab)); NavMeshPrefabs.TryAdd("220 Assurance.Level2Assurance", new AssuranceNavMesh(AssuranceNavPrefab)); NavMeshPrefabs.TryAdd("56 Vow.Level3Vow", new VowNavMesh(VowNavPrefab)); NavMeshPrefabs.TryAdd("21 Offense.Level7Offense", new OffenceNavMesh(OffenseNavPrefab)); NavMeshPrefabs.TryAdd("20 Adamance.Level10Adamance", new AdamanceNavMesh(AdamanceNavPrefab)); NavMeshPrefabs.TryAdd("5 Embrion.Level11Embrion", new EmbrionNavMesh(EmbrionNavPrefab)); NavMeshPrefabs.TryAdd("68 Artifice.Level9Artifice", new ArtificeNavMesh(ArtificeNavPrefab)); NavMeshPrefabs.TryAdd("8 Titan.Level8Titan", new TitanNavMesh(TitanNavPrefab)); } public static GameObject? GetPrefabForLevel(string levelName) { if (!NavMeshPrefabs.TryGetValue(levelName, out MoonNavMesh value)) { Plugin.LogError("No navmesh prefab found for level with scene name: " + levelName); return null; } return value.GetNavPrefab(); } public static bool IsValidLevel(string levelName) { if (NavMeshPrefabs.TryGetValue(levelName, out MoonNavMesh value)) { return value.IsPrefabEnabled(); } return false; } public static bool ArePrefabsLoaded() { if ((Object)(object)ExperimentationNavPrefab != (Object)null && (Object)(object)AssuranceNavPrefab != (Object)null && (Object)(object)VowNavPrefab != (Object)null && (Object)(object)OffenseNavPrefab != (Object)null && (Object)(object)AdamanceNavPrefab != (Object)null && (Object)(object)EmbrionNavPrefab != (Object)null && (Object)(object)ArtificeNavPrefab != (Object)null) { return (Object)(object)TitanNavPrefab != (Object)null; } return false; } public static void LogPrefabStatus() { foreach (KeyValuePair<string, MoonNavMesh> navMeshPrefab in NavMeshPrefabs) { MoonNavMesh value = navMeshPrefab.Value; if (value != null) { GameObject navPrefab = value.GetNavPrefab(); if ((Object)(object)navPrefab != (Object)null) { Plugin.LogInfo($"Navmesh prefab found for level with scene name: {navMeshPrefab.Key}. \n Is Prefab Enabled: {value.IsPrefabEnabled()}"); continue; } } Plugin.LogWarning("No navmesh prefab found for level with scene name: " + navMeshPrefab.Key); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "T-Rizzle.LethalBotsNavMeshProject"; public const string PLUGIN_NAME = "LethalBotsNavMeshProject"; public const string PLUGIN_VERSION = "1.3.0"; } [BepInPlugin("T-Rizzle.LethalBotsNavMeshProject", "LethalBotsNavMeshProject", "1.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static AssetBundle ModAssets; internal static string DirectoryName; internal static ManualLogSource Logger; internal static Config Config; private readonly Harmony _harmony = new Harmony("T-Rizzle.LethalBotsNavMeshProject"); private void Awake() { string path = "lethalbotsnavmesh"; DirectoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); Logger = ((BaseUnityPlugin)this).Logger; Config = new Config(((BaseUnityPlugin)this).Config); ModAssets = AssetBundle.LoadFromFile(Path.Combine(DirectoryName, path)); if ((Object)(object)ModAssets == (Object)null) { LogFatal("Failed to load custom assets."); return; } NavMeshPrefabManager.LoadPrefabs(); if (!NavMeshPrefabManager.ArePrefabsLoaded()) { LogWarning("Failed to load some or all of the nav mesh prefabs from the asset bundle."); LogWarning("Some levels may not have custom nav meshes."); } NavMeshPrefabManager.LogPrefabStatus(); SceneManager.sceneLoaded += OnSceneLoaded; try { _harmony.PatchAll(typeof(RoundManagerPatch)); } catch (Exception arg) { Logger.LogError((object)$"Failed to patch with error {arg}"); } LogInfo("Plugin T-Rizzle.LethalBotsNavMeshProject is loaded!"); } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.currentLevel == (Object)null) { return; } string levelName = instance.currentLevel.PlanetName + "." + instance.currentLevel.sceneName; if (!NavMeshPrefabManager.IsValidLevel(levelName)) { return; } try { LogInfo("Instantiating NavMesh prefab for moon: " + instance.currentLevel.PlanetName + " with scene name " + instance.currentLevel.sceneName); GameObject prefabForLevel = NavMeshPrefabManager.GetPrefabForLevel(levelName); if ((Object)(object)prefabForLevel == (Object)null) { LogError("Failed to get navmesh prefab for level with scene name " + instance.currentLevel.sceneName); return; } Transform val = null; GameObject val2 = GameObject.Find("Environment"); if ((Object)(object)val2 == (Object)null) { LogError("Failed to find Environment object in the scene!"); return; } Transform val3 = val2.transform.Find("NavMeshColliders"); if ((Object)(object)val3 == (Object)null) { LogWarning("Failed to find NavMeshColliders! Fallback to parenting to the Environment object."); LogError("This may cause the NavFixes to fail to work. Report this to the mod devs!"); val = val2.transform; } else { val = val3; } GameObject val4 = Object.Instantiate<GameObject>(prefabForLevel, val); NavMeshSurface[] componentsInChildren = val4.GetComponentsInChildren<NavMeshSurface>(true); NavMeshSurface[] array = componentsInChildren; foreach (NavMeshSurface val5 in array) { bool enabled = ((Behaviour)val5).enabled; ((Behaviour)val5).enabled = true; val5.defaultArea = 29; if ((Object)(object)val5.navMeshData != (Object)null) { val5.UpdateNavMesh(val5.navMeshData); } else { val5.BuildNavMesh(); } ((Behaviour)val5).enabled = enabled; } NavMeshLink[] componentsInChildren2 = val4.GetComponentsInChildren<NavMeshLink>(true); NavMeshLink[] array2 = componentsInChildren2; foreach (NavMeshLink val6 in array2) { val6.area = 29; val6.UpdateLink(); } OffMeshLink[] componentsInChildren3 = val4.GetComponentsInChildren<OffMeshLink>(true); OffMeshLink[] array3 = componentsInChildren3; foreach (OffMeshLink val7 in array3) { val7.area = 29; val7.UpdatePositions(); } } catch (Exception arg) { LogError($"Exception occurred: {arg}"); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogDebug(string debugLog) { if (Config.EnableDebugLog.Value) { Logger.LogDebug((object)debugLog); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogInfo(string infoLog) { Logger.LogInfo((object)infoLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogWarning(string warningLog) { Logger.LogWarning((object)warningLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogError(string errorLog) { Logger.LogError((object)errorLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogFatal(string errorLog) { Logger.LogFatal((object)errorLog); } } [HarmonyPatch(typeof(RoundManager))] public class RoundManagerPatch { [HarmonyPatch("BakeDunGenNavMesh")] [HarmonyPostfix] public static void BakeDunGenNavMesh_Postfix(RoundManager __instance) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) ClearExistingAutoLinks(); if (!Plugin.Config.AutoGenerateLadderLinks.Value) { Plugin.LogDebug("Auto-generation of ladder links is disabled via config."); return; } Plugin.LogDebug("Auto creating NavMeshLinks for ladders on the moon for bots."); NavMeshLink[] navMeshLinks = Object.FindObjectsByType<NavMeshLink>((FindObjectsSortMode)0); InteractTrigger[] array = Object.FindObjectsByType<InteractTrigger>((FindObjectsSortMode)0); OffMeshLink[] offMeshLinks = Object.FindObjectsByType<OffMeshLink>((FindObjectsSortMode)0); ExtensionLadderItem[] source = Object.FindObjectsByType<ExtensionLadderItem>((FindObjectsSortMode)0); foreach (InteractTrigger ladder in array) { if (!((Object)(object)ladder == (Object)null) && ladder.isLadder && (Object)(object)ladder.ladderHorizontalPosition != (Object)null && !source.Any((ExtensionLadderItem x) => (Object)(object)x.ladderScript == (Object)(object)ladder) && !OffMeshLinkExists(__instance, ladder, navMeshLinks, offMeshLinks)) { Plugin.LogDebug($"Creating NavMeshLink for ladder {ladder} with name {((Object)ladder).name}"); GameObject val = new GameObject("LadderNavMeshLink"); val.transform.position = Vector3.zero; val.transform.rotation = Quaternion.identity; val.transform.localScale = Vector3.one; val.layer = LayerMask.NameToLayer("NavigationSurface"); Vector3 navMeshPosition = __instance.GetNavMeshPosition(ladder.topOfLadderPosition.position, __instance.navHit, 2.5f, -1); Vector3 navMeshPosition2 = __instance.GetNavMeshPosition(ladder.bottomOfLadderPosition.position, __instance.navHit, 2.5f, -1); Plugin.LogDebug($"Nav Position Top: {navMeshPosition} and Bottom: {navMeshPosition2}"); NavMeshLink val2 = val.AddComponent<NavMeshLink>(); val2.agentTypeID = 0; val2.area = 29; val2.startPoint = navMeshPosition; val2.endPoint = navMeshPosition2; val2.bidirectional = true; val2.autoUpdate = true; val2.width = 0f; val2.UpdateLink(); NavMeshLinkHelper navMeshLinkHelper = ((Component)ladder).gameObject.AddComponent<NavMeshLinkHelper>(); navMeshLinkHelper.link = val2; navMeshLinkHelper.ladder = ladder; navMeshLinkHelper.topTransform = ladder.topOfLadderPosition; navMeshLinkHelper.bottomTransform = ladder.bottomOfLadderPosition; } } } private static bool OffMeshLinkExists(RoundManager instanceRM, InteractTrigger ladder, NavMeshLink[] navMeshLinks, OffMeshLink[] offMeshLinks) { //IL_0007: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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) Vector3 navMeshPosition = instanceRM.GetNavMeshPosition(ladder.topOfLadderPosition.position, instanceRM.navHit, 2.5f, -1); Vector3 navMeshPosition2 = instanceRM.GetNavMeshPosition(ladder.bottomOfLadderPosition.position, instanceRM.navHit, 2.5f, -1); Vector3 val4; foreach (NavMeshLink val in navMeshLinks) { if (!((Object)(object)val != (Object)null) || val.agentTypeID != 0) { continue; } Vector3 val2 = ((Component)val).transform.TransformPoint(val.startPoint); Vector3 val3 = ((Component)val).transform.TransformPoint(val.endPoint); val4 = navMeshPosition - val2; if (((Vector3)(ref val4)).sqrMagnitude < 6.25f) { val4 = navMeshPosition2 - val3; if (((Vector3)(ref val4)).sqrMagnitude < 6.25f) { return true; } } val4 = navMeshPosition - val3; if (((Vector3)(ref val4)).sqrMagnitude < 6.25f) { val4 = navMeshPosition2 - val2; if (((Vector3)(ref val4)).sqrMagnitude < 6.25f) { return true; } } } foreach (OffMeshLink val5 in offMeshLinks) { if (!((Object)(object)val5 != (Object)null)) { continue; } Vector3 position = val5.startTransform.position; Vector3 position2 = val5.endTransform.position; val4 = navMeshPosition - position; if (((Vector3)(ref val4)).sqrMagnitude < 6.25f) { val4 = navMeshPosition2 - position2; if (((Vector3)(ref val4)).sqrMagnitude < 6.25f) { return true; } } val4 = navMeshPosition - position2; if (((Vector3)(ref val4)).sqrMagnitude < 6.25f) { val4 = navMeshPosition2 - position; if (((Vector3)(ref val4)).sqrMagnitude < 6.25f) { return true; } } } return false; } public static void ClearExistingAutoLinks() { NavMeshLinkHelper[] array = Object.FindObjectsByType<NavMeshLinkHelper>((FindObjectsInactive)1, (FindObjectsSortMode)0); foreach (NavMeshLinkHelper navMeshLinkHelper in array) { if ((Object)(object)navMeshLinkHelper != (Object)null) { Object.DestroyImmediate((Object)(object)navMeshLinkHelper); } } Plugin.LogDebug($"Cleared {array.Length} existing auto-generated NavMeshLinks."); } } } namespace LethalBotsNavMeshProject.MoonNavMeshes { public class AdamanceNavMesh : MoonNavMesh { internal AdamanceNavMesh(GameObject prefab) { navPrefab = prefab; } public override bool IsPrefabEnabled() { return SyncedEntry<bool>.op_Implicit(Plugin.Config.EnableAdamanceNav); } } public class ArtificeNavMesh : MoonNavMesh { internal ArtificeNavMesh(GameObject prefab) { navPrefab = prefab; } public override bool IsPrefabEnabled() { return SyncedEntry<bool>.op_Implicit(Plugin.Config.EnableArtificeNav); } } public class AssuranceNavMesh : MoonNavMesh { internal AssuranceNavMesh(GameObject prefab) { navPrefab = prefab; } public override bool IsPrefabEnabled() { return SyncedEntry<bool>.op_Implicit(Plugin.Config.EnableAssuranceNav); } } public class EmbrionNavMesh : MoonNavMesh { internal EmbrionNavMesh(GameObject prefab) { navPrefab = prefab; } public override bool IsPrefabEnabled() { return SyncedEntry<bool>.op_Implicit(Plugin.Config.EnableEmbrionNav); } } public class ExperimentationNavMesh : MoonNavMesh { internal ExperimentationNavMesh(GameObject prefab) { navPrefab = prefab; } public override bool IsPrefabEnabled() { return SyncedEntry<bool>.op_Implicit(Plugin.Config.EnableExperimentationNav); } } public abstract class MoonNavMesh { protected GameObject? navPrefab; public virtual bool IsPrefabEnabled() { return true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public GameObject? GetNavPrefab() { return navPrefab; } } internal class OffenceNavMesh : MoonNavMesh { internal OffenceNavMesh(GameObject prefab) { navPrefab = prefab; } public override bool IsPrefabEnabled() { return SyncedEntry<bool>.op_Implicit(Plugin.Config.EnableOffenceNav); } } public class TitanNavMesh : MoonNavMesh { internal TitanNavMesh(GameObject prefab) { navPrefab = prefab; } public override bool IsPrefabEnabled() { return SyncedEntry<bool>.op_Implicit(Plugin.Config.EnableTitanNav); } } public class VowNavMesh : MoonNavMesh { internal VowNavMesh(GameObject prefab) { navPrefab = prefab; } public override bool IsPrefabEnabled() { return SyncedEntry<bool>.op_Implicit(Plugin.Config.EnableVowNav); } } } namespace LethalBotsNavMeshProject.Helpers { internal class NavMeshLinkHelper : MonoBehaviour { public NavMeshLink? link; public InteractTrigger? ladder; public Transform? topTransform; public Transform? bottomTransform; public float UpdateInterval = 0.5f; private float updateTimer; private void Update() { updateTimer += Time.deltaTime; if (updateTimer > UpdateInterval) { updateTimer = 0f; SyncPoints(); } } private void SyncPoints() { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)link != (Object)null)) { return; } bool flag = (Object)(object)ladder == (Object)null || (((Component)ladder).gameObject.activeInHierarchy && ((Behaviour)ladder).enabled); if (((Behaviour)link).enabled != flag) { ((Behaviour)link).enabled = flag; } if (!flag) { return; } if ((Object)(object)topTransform == (Object)null) { if ((Object)(object)ladder == (Object)null) { return; } topTransform = ladder.topOfLadderPosition; } if ((Object)(object)bottomTransform == (Object)null) { if ((Object)(object)ladder == (Object)null) { return; } bottomTransform = ladder.bottomOfLadderPosition; } RoundManager instance = RoundManager.Instance; Vector3 navMeshPosition = instance.GetNavMeshPosition(topTransform.position, instance.navHit, 2.5f, -1); Vector3 navMeshPosition2 = instance.GetNavMeshPosition(bottomTransform.position, instance.navHit, 2.5f, -1); link.startPoint = navMeshPosition; link.endPoint = navMeshPosition2; } private void OnDestroy() { if ((Object)(object)link != (Object)null) { Object.Destroy((Object)(object)((Component)link).gameObject); } } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } }