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 ModpackCompatibilityFixes v0.1.0
plugins\ModpackCompatibilityFixes.dll
Decompiled 17 minutes agousing System; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; using UnityEngine.SceneManagement; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyVersion("0.0.0.0")] namespace ModpackCompatibilityFixes; [BepInPlugin("local.modpackcompatibilityfixes", "ModpackCompatibilityFixes", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { private const string Id = "local.modpackcompatibilityfixes"; private static ManualLogSource Log; private static readonly HashSet<string> Reported = new HashSet<string>(); private static long skipped; private static MethodBase Target; private Harmony harmony; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; harmony = new Harmony("local.modpackcompatibilityfixes"); ConfigEntry<bool> val = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "TerminalAccessibleObjectGuard", true, "Skip invalid radar marker updates. Restart the game after changing this setting."); ConfigEntry<bool> val2 = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "SlidingCompanyNoDust", true, "Disable SlidingCompany 1.1.2 dust emission only. Restart the game after changing this setting."); if (val.Value) { if (Chainloader.PluginInfos.ContainsKey("local.terminalaccessibleobjectfix")) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Legacy TerminalAccessibleObjectFix detected. Skipping duplicate guard; remove the legacy DLL."); } else { TryInstallTao(); } } if (val2.Value) { TryInstallSlide(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"ModpackCompatibilityFixes 0.1.0 initialization complete."); } private void TryInstallTao() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown try { Target = AccessTools.DeclaredMethod(typeof(TerminalAccessibleObject), "Update", Type.EmptyTypes, (Type[])null); if (Target == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"TerminalAccessibleObject.Update not found; guard skipped."); return; } HarmonyMethod val = new HarmonyMethod(typeof(Plugin), "GuardUpdate", (Type[])null); val.priority = 800; harmony.Patch(Target, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)("TAO guard installed. Assembly MVID: " + Target.Module.ModuleVersionId)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Could not install TAO guard: " + ex)); } } private void TryInstallSlide() { //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown try { if (!Chainloader.PluginInfos.TryGetValue("CoddingCat.SlidingCompany", out var value) || (Object)(object)value.Instance == (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"SlidingCompany not loaded; NoDust skipped."); return; } Version version = value.Metadata.Version; if (version.Major != 1 || version.Minor != 1 || version.Build != 2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)string.Concat("SlidingCompany ", version, " not validated; NoDust skipped.")); return; } Assembly assembly = ((object)value.Instance).GetType().Assembly; Type type = assembly.GetType("PlayerSlide", throwOnError: false); if (type == null) { Type[] types = assembly.GetTypes(); foreach (Type type2 in types) { if (type2.Name == "PlayerSlide") { type = type2; break; } } } MethodInfo methodInfo = ((type == null) ? null : AccessTools.DeclaredMethod(type, "EmitDust", Type.EmptyTypes, (Type[])null)); if (methodInfo == null || methodInfo.ReturnType != typeof(void) || methodInfo.IsStatic) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"PlayerSlide.EmitDust signature not found; NoDust skipped."); return; } HarmonyMethod val = new HarmonyMethod(typeof(Plugin), "SkipDust", (Type[])null); val.priority = 800; harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"SlidingCompany NoDust installed: PlayerSlide.EmitDust only."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Could not install SlidingCompany NoDust: " + ex)); } } public static bool SkipDust() { return false; } public static bool GuardUpdate(TerminalAccessibleObject __instance) { if ((Object)(object)__instance == (Object)null) { return Skip(__instance, "component missing"); } GameNetworkManager instance = GameNetworkManager.Instance; if ((Object)(object)instance == (Object)null) { return Skip(__instance, "GameNetworkManager.Instance missing"); } PlayerControllerB localPlayerController = instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return Skip(__instance, "localPlayerController missing"); } StartOfRound instance2 = StartOfRound.Instance; if ((Object)(object)instance2 == (Object)null) { return Skip(__instance, "StartOfRound.Instance missing"); } ManualCameraRenderer mapScreen = instance2.mapScreen; if ((Object)(object)mapScreen == (Object)null) { return Skip(__instance, "mapScreen missing"); } if (!localPlayerController.isInHangarShipRoom && !mapScreen.overrideRadarCameraOnAlways) { return true; } if ((Object)(object)mapScreen.mapCamera == (Object)null) { return Skip(__instance, "mapCamera missing"); } if ((Object)(object)__instance.mapRadarObject == (Object)null) { return Skip(__instance, "mapRadarObject missing"); } return true; } private static bool Skip(TerminalAccessibleObject instance, string reason) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) skipped++; try { if (Reported.Count < 128) { int num = ((!((Object)(object)instance == (Object)null)) ? ((Object)instance).GetInstanceID() : 0); string item = num + ":" + reason; if (Reported.Add(item)) { string text = "component unavailable"; if ((Object)(object)instance != (Object)null) { GameObject gameObject = ((Component)instance).gameObject; string text2 = ((Object)gameObject).name; Transform parent = gameObject.transform.parent; int num2 = 0; while ((Object)(object)parent != (Object)null && num2 < 12) { text2 = ((Object)parent).name + "/" + text2; num2++; parent = parent.parent; } object[] array = new object[8] { "id=", num, ", scene=", null, null, null, null, null }; Scene scene = gameObject.scene; array[3] = ((Scene)(ref scene)).name; array[4] = ", path="; array[5] = text2; array[6] = ", code="; array[7] = instance.objectCode; text = string.Concat(array); } Log.LogWarning((object)("[TAO guard] " + reason + " | " + text)); } } if (skipped == 100 || skipped == 1000 || skipped == 10000 || skipped == 100000 || skipped == 1000000) { Log.LogInfo((object)("[TAO guard] total skipped invalid radar updates=" + skipped)); } } catch (Exception) { } return false; } }