Please disclose if your mod was created primarily 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 AlwaysInBounds v1.2.1
Tomatobird.AlwaysInBounds.dll
Decompiled a month agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AlwaysInBounds.Patches; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [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: AssemblyCompany("Tomatobird.AlwaysInBounds")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.2.1.0")] [assembly: AssemblyInformationalVersion("1.2.1+1b3e49ceb533684ee843ededadc50949a433b06d")] [assembly: AssemblyProduct("AlwaysInBounds")] [assembly: AssemblyTitle("Tomatobird.AlwaysInBounds")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.1.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 AlwaysInBounds { [BepInPlugin("Tomatobird.AlwaysInBounds", "AlwaysInBounds", "1.2.1")] public class AlwaysInBounds : BaseUnityPlugin { public enum LocationType { Ship, Entrance, Dynamic } public static LocationType tpLocationType; public static bool spawnbody; public static bool noBodyShipFearEffect; public static AlwaysInBounds Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Instance = this; string value = ((BaseUnityPlugin)this).Config.Bind<string>("General", "TpLocationConfig", "Dynamic", new ConfigDescription("Where to teleport player when player falls out of bounds", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "Ship", "Entrance", "Dynamic" }), Array.Empty<object>())).Value; spawnbody = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SpawnPlayerBody", true, "Should KillPlayer method be patched to always spawn body?").Value; noBodyShipFearEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RemoveBodyFearInShip", true, "Disable fear effect from seeing a player body in ship?").Value; tpLocationType = ((!(value == "Ship")) ? ((value == "Entrance") ? LocationType.Entrance : LocationType.Dynamic) : LocationType.Ship); Patch(); Logger.LogInfo((object)"Tomatobird.AlwaysInBounds v1.2.1 has loaded!"); } 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("Tomatobird.AlwaysInBounds"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(typeof(OutOfBoundsTriggerPatch)); if (noBodyShipFearEffect) { Harmony.PatchAll(typeof(DeadBodyPatch)); } if (spawnbody) { Harmony.PatchAll(typeof(KillPlayerPatch)); } Logger.LogDebug((object)"Finished patching!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Tomatobird.AlwaysInBounds"; public const string PLUGIN_NAME = "AlwaysInBounds"; public const string PLUGIN_VERSION = "1.2.1"; } } namespace AlwaysInBounds.Patches { [HarmonyPatch(typeof(DeadBodyInfo))] public class DeadBodyPatch { [HarmonyPatch("DetectIfSeenByLocalPlayer")] [HarmonyPrefix] public static bool BodyDetectPatch(DeadBodyInfo __instance) { if (__instance.isInShip) { return false; } return true; } } [HarmonyPatch(typeof(PlayerControllerB))] public class KillPlayerPatch { [HarmonyPatch("KillPlayer")] [HarmonyPrefix] private static bool KillPlayerMethodPatch(PlayerControllerB __instance, ref bool spawnBody) { spawnBody = true; return true; } } [HarmonyPatch(typeof(OutOfBoundsTrigger))] public class OutOfBoundsTriggerPatch { [HarmonyPatch("OnTriggerEnter")] [HarmonyPrefix] private static bool OnTriggerEnterPatch(OutOfBoundsTrigger __instance, ref Collider other) { //IL_00c9: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if (((Component)other).tag != "Player" || (__instance.disableWhenRoundStarts && !__instance.playersManager.inShipPhase)) { return true; } PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>(); if ((Object)(object)component == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)component || !__instance.playersManager.shipDoorsEnabled) { return true; } if (!StartOfRound.Instance.isChallengeFile) { component.ResetFallGravity(); switch (AlwaysInBounds.tpLocationType) { case AlwaysInBounds.LocationType.Ship: component.TeleportPlayer(__instance.playersManager.outsideShipSpawnPosition.position, false, 0f, false, true); break; case AlwaysInBounds.LocationType.Entrance: component.TeleportPlayer(Object.FindObjectOfType<EntranceTeleport>().entrancePoint.position, false, 0f, false, true); break; case AlwaysInBounds.LocationType.Dynamic: if (component.isInsideFactory) { component.TeleportPlayer(Object.FindObjectOfType<EntranceTeleport>().entrancePoint.position, false, 0f, false, true); } else { component.TeleportPlayer(__instance.playersManager.outsideShipSpawnPosition.position, false, 0f, false, true); } break; default: return true; } component.isInsideFactory = false; return false; } return true; } } }