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 OrbitDoorsAndSpacewalk v1.0.0
OrbitDoorsAndSpacewalk.dll
Decompiled a day agousing System; 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 GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using OrbitDoorsAndSpacewalk.Patches; using UnityEngine; [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("Khameli0n")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Standalone Orbit Doors & Zero-Death Spacewalk Safety mod for Lethal Company.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("OrbitDoorsAndSpacewalk")] [assembly: AssemblyTitle("OrbitDoorsAndSpacewalk")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 OrbitDoorsAndSpacewalk { public static class Configuration { public static ConfigEntry<bool> EnableOrbitDoorControls { get; private set; } public static ConfigEntry<bool> EnableSpacewalkSafety { get; private set; } public static void Init(ConfigFile cfg) { EnableOrbitDoorControls = cfg.Bind<bool>("OrbitDoors", "EnableOrbitDoorControls", true, "Allows opening and closing the ship hangar doors at any time while in orbit."); EnableSpacewalkSafety = cfg.Bind<bool>("SpacewalkSafety", "EnableSpacewalkSafety", true, "Prevents players and furniture from being sucked out into space in orbit and safely teleports players back inside if they drift away."); } } [BepInPlugin("com.khameli0n.orbitdoorsandspacewalk", "OrbitDoorsAndSpacewalk", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "com.khameli0n.orbitdoorsandspacewalk"; public const string PLUGIN_NAME = "OrbitDoorsAndSpacewalk"; public const string PLUGIN_VERSION = "1.0.0"; public static Plugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } public static Harmony HarmonyInstance { get; private set; } private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; Configuration.Init(((BaseUnityPlugin)this).Config); HarmonyInstance = new Harmony("com.khameli0n.orbitdoorsandspacewalk"); try { HarmonyInstance.CreateClassProcessor(typeof(OrbitSafetyPatches)).Patch(); Log.LogInfo((object)string.Format("{0} v{1} loaded (OrbitDoors={2}, SpacewalkSafety={3}).", "OrbitDoorsAndSpacewalk", "1.0.0", Configuration.EnableOrbitDoorControls.Value, Configuration.EnableSpacewalkSafety.Value)); } catch (Exception arg) { Log.LogError((object)string.Format("Failed to apply patches for {0}: {1}", "OrbitDoorsAndSpacewalk", arg)); } } } } namespace OrbitDoorsAndSpacewalk.Patches { [HarmonyPatch] public static class OrbitSafetyPatches { private static bool hasLoggedOrbitHeartbeat; [HarmonyPatch(typeof(HangarShipDoor), "SetDoorButtonsEnabled")] [HarmonyPrefix] public static void HangarShipDoor_SetDoorButtonsEnabled_Prefix(ref bool doorButtonsEnabled) { if (Configuration.EnableOrbitDoorControls.Value) { doorButtonsEnabled = true; } } [HarmonyPatch(typeof(HangarShipDoor), "PlayDoorAnimation")] [HarmonyPrefix] public static void HangarShipDoor_PlayDoorAnimation_Prefix(HangarShipDoor __instance) { if (Configuration.EnableOrbitDoorControls.Value && (Object)(object)__instance != (Object)null) { __instance.buttonsEnabled = true; } } [HarmonyPatch(typeof(HangarShipDoor), "Update")] [HarmonyPostfix] public static void HangarShipDoor_Update_Postfix(HangarShipDoor __instance) { if (Configuration.EnableOrbitDoorControls.Value && !((Object)(object)__instance == (Object)null) && !((Object)(object)StartOfRound.Instance == (Object)null) && StartOfRound.Instance.inShipPhase) { __instance.buttonsEnabled = true; if ((Object)(object)__instance.triggerScript != (Object)null) { __instance.triggerScript.interactable = true; } } } [HarmonyPatch(typeof(StartOfRound), "Update")] [HarmonyPrefix] public static void StartOfRound_Update_OrbitSafety_Prefix(StartOfRound __instance) { if (!Configuration.EnableSpacewalkSafety.Value || (Object)(object)__instance == (Object)null || !__instance.inShipPhase) { return; } __instance.suckingPlayersOutOfShip = false; __instance.suckingFurnitureOutOfShip = false; if (!hasLoggedOrbitHeartbeat) { hasLoggedOrbitHeartbeat = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[OrbitSafety] Diagnostic Heartbeat: Orbit door controls & zero-death spacewalk active."); } } } [HarmonyPatch(typeof(StartOfRound), "SuckLocalPlayerOutOfShipDoor")] [HarmonyPrefix] public static bool StartOfRound_SuckLocalPlayerOutOfShipDoor_Prefix() { if (!Configuration.EnableSpacewalkSafety.Value) { return true; } if ((Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.inShipPhase) { return false; } return true; } [HarmonyPatch(typeof(StartOfRound), "LateUpdate")] [HarmonyPostfix] public static void StartOfRound_LateUpdate_OrbitSafety_Postfix(StartOfRound __instance) { //IL_0048: 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) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!Configuration.EnableSpacewalkSafety.Value || (Object)(object)__instance == (Object)null || !__instance.inShipPhase) { return; } PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null) && !val.isPlayerDead) { bool num = ((Component)val).transform.position.y < -25f; bool flag = (Object)(object)__instance.elevatorTransform != (Object)null && Vector3.Distance(((Component)val).transform.position, __instance.elevatorTransform.position) > 28f; if (num || flag) { RescueOrbitPlayer(val); } } } private static void RescueOrbitPlayer(PlayerControllerB player) { //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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)player == (Object)null) && !((Object)(object)StartOfRound.Instance == (Object)null)) { player.fallValue = 0f; player.fallValueUncapped = 0f; player.externalForces = Vector3.zero; Vector3 val = (((Object)(object)StartOfRound.Instance.middleOfShipNode != (Object)null) ? StartOfRound.Instance.middleOfShipNode.position : (StartOfRound.Instance.elevatorTransform.position + Vector3.up * 1f)); player.TeleportPlayer(val, false, 0f, false, true); } } } }