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 ExtremeTerminalFix v1.0.1
BepInEx/plugins/ExtremeTerminalFix/ExtremeTerminalFix.dll
Decompiled 11 hours 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 TMPro; using UnityEngine; using UnityEngine.EventSystems; [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("ExtremeTerminalFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("ExtremeTerminalFix")] [assembly: AssemblyTitle("ExtremeTerminalFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.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 ExtremeTerminalFix { [BepInPlugin("TheFixer.ExtremeTerminalFix", "ExtremeTerminalFix", "1.0.1")] public class Plugin : BaseUnityPlugin { internal const string Command = "fixmeplease"; internal static ManualLogSource Log; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; new Harmony("TheFixer.ExtremeTerminalFix").PatchAll(typeof(Plugin).Assembly); } internal static bool IsCommand(string text) { return text?.Trim().Equals("fixmeplease", StringComparison.OrdinalIgnoreCase) ?? false; } internal static void Rescue() { PlayerControllerB player = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)player == (Object)null) { return; } Log.LogInfo((object)("fixmeplease: rescuing " + player.playerUsername)); Terminal terminal = Object.FindObjectOfType<Terminal>(); InteractTrigger trigger = (((Object)(object)terminal != (Object)null) ? ((Component)terminal).GetComponent<InteractTrigger>() : null); Try("quit terminal", delegate { if ((Object)(object)terminal != (Object)null) { terminal.QuitTerminal(true); } }); Try("reset terminal", delegate { if (!((Object)(object)terminal == (Object)null)) { terminal.terminalInUse = false; terminal.screenText.ReleaseSelection(); terminal.screenText.DeactivateInputField(false); terminal.SetTerminalInUseLocalClient(false); } }); Try("clear UI focus", delegate { if ((Object)(object)EventSystem.current != (Object)null) { EventSystem.current.SetSelectedGameObject((GameObject)null); } }); Try("reset trigger", delegate { if (!((Object)(object)trigger == (Object)null)) { trigger.SetInteractTriggerNotInAnimation((int)player.playerClientId); trigger.isPlayingSpecialAnimation = false; trigger.lockedPlayer = null; trigger.currentCooldownValue = 0f; } }); Try("reset player", delegate { //IL_0088: Unknown result type (might be due to invalid IL or missing references) player.inTerminalMenu = false; player.inSpecialInteractAnimation = false; player.currentTriggerInAnimationWith = null; player.inVehicleAnimation = false; player.isClimbingLadder = false; player.clampLooking = false; player.disableLookInput = false; player.disableMoveInput = false; player.disableInteract = false; player.isTypingChat = false; ((Component)player.gameplayCamera).transform.localEulerAngles = Vector3.zero; }); Try("sync animation", delegate { player.UpdateSpecialAnimationValue(false, (short)0, 0f, false); }); Try("hud", delegate { if (player.isHoldingObject && (Object)(object)player.currentlyHeldObjectServer != (Object)null) { player.currentlyHeldObjectServer.SetControlTipsForItem(); } else { HUDManager.Instance.ClearControlTips(); } }); Try("cursor", delegate { Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; }); if (!player.isPlayerDead) { Try("teleport", delegate { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Transform[] playerSpawnPositions = StartOfRound.Instance.playerSpawnPositions; Vector3 position = playerSpawnPositions[(int)player.playerClientId % playerSpawnPositions.Length].position; player.TeleportPlayer(position, false, 0f, true, true); player.isInElevator = true; player.isInHangarShipRoom = true; player.isInsideFactory = false; }); } Try("notify", delegate { HUDManager.Instance.DisplayTip("ExtremeTerminalFix", "You've been pulled off the terminal.", false, false, "LC_Tip1"); }); } private static void Try(string step, Action action) { try { action(); } catch (Exception ex) { Log.LogWarning((object)("fixmeplease: step '" + step + "' failed (continuing): " + ex.Message)); } } } [HarmonyPatch] internal static class Patches { [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] private static void AddToOtherPage(Terminal __instance) { TerminalKeyword[] allKeywords = __instance.terminalNodes.allKeywords; foreach (TerminalKeyword val in allKeywords) { if (!((Object)(object)val == (Object)null) && !(val.word != "other") && !((Object)(object)val.specialKeywordResult == (Object)null)) { TerminalNode specialKeywordResult = val.specialKeywordResult; if (!specialKeywordResult.displayText.Contains(">FIXMEPLEASE")) { specialKeywordResult.displayText = specialKeywordResult.displayText.TrimEnd() + "\n\n>FIXMEPLEASE\nForce yourself off the terminal and back onto the ship if you get stuck.\n\n"; } return; } } Plugin.Log.LogWarning((object)"Couldn't find the terminal's OTHER page; fixmeplease still works, it just isn't listed."); } [HarmonyPatch(typeof(Terminal), "OnSubmit")] [HarmonyPrefix] private static bool TerminalSubmit(Terminal __instance) { TMP_InputField screenText = __instance.screenText; if ((Object)(object)screenText == (Object)null || __instance.textAdded <= 0 || __instance.textAdded > screenText.text.Length) { return true; } if (!Plugin.IsCommand(screenText.text.Substring(screenText.text.Length - __instance.textAdded))) { return true; } screenText.text = screenText.text.Substring(0, screenText.text.Length - __instance.textAdded); __instance.textAdded = 0; Plugin.Rescue(); return false; } [HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")] [HarmonyPrefix] private static bool ChatSubmit(HUDManager __instance) { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null || !val.isTypingChat || !Plugin.IsCommand(__instance.chatTextField.text)) { return true; } __instance.chatTextField.text = ""; val.isTypingChat = false; ((Behaviour)__instance.typingIndicator).enabled = false; Plugin.Rescue(); return false; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "TheFixer.ExtremeTerminalFix"; public const string PLUGIN_NAME = "ExtremeTerminalFix"; public const string PLUGIN_VERSION = "1.0.1"; } }