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 OuterDoorButtons v1.0.2
BepInEx/plugins/OuterDoorButtons.dll
Decompiled 2 years 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.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using OuterDoorButtons.Utilities; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [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("OuterDoorButtons")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds a button to the outside of the door to be able to open it when you got locked out.")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("OuterDoorButtons")] [assembly: AssemblyTitle("OuterDoorButtons")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace OuterDoorButtons { [BepInPlugin("OuterDoorButtons", "OuterDoorButtons", "1.0.2")] public class Plugin : BaseUnityPlugin { private static readonly Harmony harmony = new Harmony("OuterDoorButtons"); public static ManualLogSource CLog; private void Awake() { CLog = ((BaseUnityPlugin)this).Logger; CLog.LogInfo((object)"Plugin OuterDoorButtons is loaded!"); harmony.PatchAll(); } } public static class PluginInfo { public const string PLUGIN_GUID = "OuterDoorButtons"; public const string PLUGIN_NAME = "OuterDoorButtons"; public const string PLUGIN_VERSION = "1.0.2"; } } namespace OuterDoorButtons.Utilities { public static class Console { public static bool DebugState; public static void LogFatal(string message) { SendLog(message, "LogFatal"); } public static void LogError(string message) { SendLog(message, "LogError"); } public static void LogWarning(string message) { SendLog(message, "LogWarning"); } public static void Log(string message) { SendLog(message, "Log"); } public static void LogInfo(string message) { SendLog(message, "LogInfo"); } public static void LogMessage(string message) { SendLog(message, "LogMessage"); } public static void LogDebug(string message) { SendLog(message, "LogDebug"); } private static void SendLog(string message, string level = null) { if (!DebugState && (level != "LogFatal" || level != "LogError" || level != "LogWarning")) { return; } switch (level) { case "LogFatal": Plugin.CLog.LogFatal((object)message); return; case "LogError": Plugin.CLog.LogError((object)message); return; case "LogWarning": Plugin.CLog.LogWarning((object)message); return; case "LogInfo": Plugin.CLog.LogInfo((object)message); return; case "LogMessage": Plugin.CLog.LogMessage((object)message); return; case "LogDebug": Plugin.CLog.LogDebug((object)message); return; } if (level != "Log") { Debug.Log((object)("[" + level + "]: " + message)); } else { Debug.Log((object)message); } } } } namespace OuterDoorButtons.Patches { [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { private static Transform MonitorWall; private static Transform OriginalDoorPanel; private static InteractTrigger OriginalOpenButtonTrigger; private static InteractTrigger OriginalCloseButtonTrigger; private static TextMeshProUGUI OriginalPanelMeter; public static Transform DoorPanel; private static Transform OpenButton; private static Transform CloseButton; private static InteractTrigger OpenButtonTrigger; private static Transform PanelMeter; private static TextMeshProUGUI PanelMeterText; private static string[] VisibleTriggerPathsOrbit = new string[2] { "Environment/HangarShip/ReverbTriggers/", "Environment/HangarShip/ReverbTriggers/LeavingShipTriggers/HorizontalTriggers/" }; private static string[] VisibleTriggerPathsLanded = new string[2] { "Environment/NavMeshColliders/PlayerShipNavmesh/", "Environment/ReverbTriggers (1)/WindTriggers/" }; [HarmonyPostfix] [HarmonyPatch("Start")] private static void StartPatch() { OuterDoorButtons.Utilities.Console.LogInfo("StartOfRound.Start() called"); GetObjectReferences(); if (!((Object)(object)MonitorWall == (Object)null) && !((Object)(object)OriginalDoorPanel == (Object)null)) { CreateOuterDoorPanel(); } } [HarmonyPostfix] [HarmonyPatch("Update")] private static void UpdatePatch() { if (!((Object)(object)OriginalPanelMeter == (Object)null) && !((Object)(object)PanelMeterText == (Object)null)) { ((TMP_Text)PanelMeterText).SetText(((TMP_Text)OriginalPanelMeter).text, true); } } [HarmonyPostfix] [HarmonyPatch("OnShipLandedMiscEvents")] private static void OnShipLandedMiscEventsPatch() { OuterDoorButtons.Utilities.Console.LogInfo("StartOfRound.OnShipLandedMiscEvents() called"); } private static void DisableVisibleTriggers(string[] triggerPaths) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown foreach (string text in triggerPaths) { Transform transform = GameObject.Find(text).transform; if ((Object)(object)transform == (Object)null) { OuterDoorButtons.Utilities.Console.LogError("StartOfRound.DisableTrigger() could not find: \n" + text); continue; } MeshRenderer component = ((Component)transform).GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; OuterDoorButtons.Utilities.Console.LogInfo("Disabled " + ((Object)transform).name); } else if (transform.childCount > 0) { foreach (Transform item in transform) { Transform val = item; MeshRenderer component2 = ((Component)val).GetComponent<MeshRenderer>(); if ((Object)(object)component2 != (Object)null) { ((Renderer)component2).enabled = false; OuterDoorButtons.Utilities.Console.LogInfo("Disabled " + ((Object)transform).name + " > " + ((Object)val).name); } } } else { OuterDoorButtons.Utilities.Console.LogWarning("StartOfRound.DisableTrigger() could not find MeshRenderer on " + ((Object)transform).name); } } } private static void GetObjectReferences() { MonitorWall = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall").transform; if ((Object)(object)MonitorWall == (Object)null) { OuterDoorButtons.Utilities.Console.LogError("StartOfRound.GetMonitorButton() could not find MonitorWall"); return; } OriginalDoorPanel = GameObject.Find("Environment/HangarShip/AnimatedShipDoor/HangarDoorButtonPanel").transform; Transform val = OriginalDoorPanel.Find("StartButton").Find("Cube (2)"); Transform val2 = OriginalDoorPanel.Find("StopButton").Find("Cube (3)"); if ((Object)(object)OriginalDoorPanel == (Object)null || (Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { OuterDoorButtons.Utilities.Console.LogError("StartOfRound.GetDoorPanel() could not find HangarDoorButtonPanel references"); return; } OriginalOpenButtonTrigger = ((Component)val).GetComponent<InteractTrigger>(); OriginalCloseButtonTrigger = ((Component)val2).GetComponent<InteractTrigger>(); OriginalPanelMeter = ((Component)OriginalDoorPanel.Find("ElevatorPanelScreen/Image/meter")).GetComponent<TextMeshProUGUI>(); } private static void CreateOuterDoorPanel() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)MonitorWall.Find("OuterDoorPanel") != (Object)null) { OuterDoorButtons.Utilities.Console.LogError("StartOfRound.CreateOuterDoorPanel() OuterDoorPanel already exists"); return; } DoorPanel = Object.Instantiate<Transform>(OriginalDoorPanel, OriginalDoorPanel.parent); ((Object)DoorPanel).name = "OuterDoorPanel"; DoorPanel.position = new Vector3(-6.36f, 2.15f, -16.23f); DoorPanel.localEulerAngles = new Vector3(90f, 90f, 0f); ((Renderer)((Component)DoorPanel).GetComponent<MeshRenderer>()).enabled = false; OuterDoorButtons.Utilities.Console.LogInfo("StartOfRound.CreateOuterDoorPanel() created: " + ((Object)DoorPanel).name); GameObject gameObject = ((Component)DoorPanel.Find("ScanNode (2)")).gameObject; if ((Object)(object)gameObject != (Object)null) { gameObject.SetActive(false); } else { OuterDoorButtons.Utilities.Console.LogWarning("StartOfRound.CreateOuterDoorPanel() could not find ScanNode (2)"); } OpenButton = DoorPanel.Find("StartButton").Find("Cube (2)"); CloseButton = DoorPanel.Find("StopButton"); if ((Object)(object)OpenButton == (Object)null || (Object)(object)CloseButton == (Object)null) { OuterDoorButtons.Utilities.Console.LogError("StartOfRound.CreateOuterDoorPanel() could not find OuterDoorPanel references"); return; } ((Component)CloseButton).gameObject.SetActive(false); ((Object)OpenButton.parent).name = "OuterOpenButton"; OpenButton.parent.localScale = new Vector3(-3.5f, -3.5f, -3.5f); OpenButtonTrigger = ((Component)OpenButton).GetComponent<InteractTrigger>(); ((UnityEvent<PlayerControllerB>)(object)OpenButtonTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)delegate(PlayerControllerB player) { CustomTrigger(player, OriginalOpenButtonTrigger, OpenButton); }); PanelMeter = ((Component)DoorPanel.Find("ElevatorPanelScreen")).transform; if ((Object)(object)PanelMeter == (Object)null) { OuterDoorButtons.Utilities.Console.LogError("StartOfRound.CreateOuterDoorPanel() could not find ElevatorPanelScreen"); return; } PanelMeter.localPosition = new Vector3(0.1f, 0.02f, 0.32f); Transform transform = ((Component)DoorPanel.Find("ElevatorPanelScreen/Image")).transform; if ((Object)(object)transform == (Object)null) { OuterDoorButtons.Utilities.Console.LogError("StartOfRound.CreateOuterDoorPanel() could not find Image on ElevatorPanelScreen"); return; } Image component = ((Component)transform).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; } else { OuterDoorButtons.Utilities.Console.LogWarning("StartOfRound.CreateOuterDoorPanel() could not find Image on ElevatorPanelScreen"); } GameObject gameObject2 = ((Component)transform.Find("doorHydraulics")).gameObject; if ((Object)(object)gameObject2 != (Object)null) { gameObject2.SetActive(false); } else { OuterDoorButtons.Utilities.Console.LogWarning("StartOfRound.CreateOuterDoorPanel() could not find doorHydraulics"); } PanelMeterText = ((Component)transform.Find("meter")).GetComponent<TextMeshProUGUI>(); ((TMP_Text)PanelMeterText).alignment = (TextAlignmentOptions)258; ((TMP_Text)PanelMeterText).horizontalAlignment = (HorizontalAlignmentOptions)2; } private static void CustomTrigger(PlayerControllerB sender, InteractTrigger originalTrigger, Transform trigger, string state = "Open") { ((UnityEvent<PlayerControllerB>)(object)originalTrigger.onInteract).Invoke(sender); ((Component)trigger).GetComponent<AnimatedObjectTrigger>().triggerAnimator.SetTrigger(state + "Door"); OuterDoorButtons.Utilities.Console.LogMessage("StartOfRound.CustomTrigger() called for " + ((Object)trigger).name + " with state " + state); } } }