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 Open Doors in Space v1.0.1
OpenDoorsInSpace.dll
Decompiled 2 years agousing System; using System.Collections.Generic; 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 HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("OpenDoorsInSpace")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Open doors while the ship is in space. You won't believe what happens!")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+47162338a20a6e962c525d72327627e0f3b90001")] [assembly: AssemblyProduct("OpenDoorsInSpace")] [assembly: AssemblyTitle("OpenDoorsInSpace")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace OpenDoorsInSpace { [BepInPlugin("OpenDoorsInSpace", "OpenDoorsInSpace", "1.0.1")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static OpenDoorsInSpacePluginManager Manager; public Plugin() { Log = ((BaseUnityPlugin)this).Logger; } private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown GameObject val = new GameObject("OpenDoorsInSpace"); val.AddComponent<OpenDoorsInSpacePluginManager>(); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)val); Manager = val.GetComponent<OpenDoorsInSpacePluginManager>(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin OpenDoorsInSpace is loaded!"); } } public class OpenDoorsInSpacePluginManager : MonoBehaviour { private TextMeshProUGUI youAreFiredDueToNegliganceSubtextTMP; public bool IsEjectingDueToNegligence { get; internal set; } private void Start() { Plugin.Log.LogDebug((object)"OpenDoorsInSpacePluginManager Start"); SceneManager.activeSceneChanged += HandleActiveSceneChanged; } private void HandleActiveSceneChanged(Scene prevScene, Scene activeScene) { ResetEjectingDueToNegligance(); } private GameObject FindYouAreFiredOriginalSubtextGameObject() { return GameObject.Find("/Systems/UI/Canvas/GameOverScreen/MaskImage/HeaderText (1)"); } private TextMeshProUGUI CreateYouAreFiredDueToNegliganceSubtext() { GameObject obj = FindYouAreFiredOriginalSubtextGameObject(); GameObject val = Object.Instantiate<GameObject>(obj, obj.transform.parent); ((Object)val).name = ((Object)val).name + " (OpenDoorsInSpace fired subtext)"; val.SetActive(false); youAreFiredDueToNegliganceSubtextTMP = val.GetComponent<TextMeshProUGUI>(); ((TMP_Text)youAreFiredDueToNegliganceSubtextTMP).text = "Someone opened the hangar door while in space."; return youAreFiredDueToNegliganceSubtextTMP; } public void EjectDueToNegligance() { if (StartOfRound.Instance.firingPlayersCutsceneRunning || IsEjectingDueToNegligence) { Plugin.Log.LogInfo((object)"Could not eject due to negligance: cutscene is already running"); return; } Plugin.Log.LogInfo((object)"Ejecting due to negligance"); IsEjectingDueToNegligence = true; StartOfRound.Instance.ManuallyEjectPlayersServerRpc(); if ((Object)(object)youAreFiredDueToNegliganceSubtextTMP == (Object)null) { youAreFiredDueToNegliganceSubtextTMP = CreateYouAreFiredDueToNegliganceSubtext(); } FindYouAreFiredOriginalSubtextGameObject().SetActive(false); ((Component)youAreFiredDueToNegliganceSubtextTMP).gameObject.SetActive(true); } public void ResetEjectingDueToNegligance() { Plugin.Log.LogInfo((object)"Reseting ..."); GameObject obj = FindYouAreFiredOriginalSubtextGameObject(); if (obj != null) { obj.SetActive(true); } if ((Object)(object)youAreFiredDueToNegliganceSubtextTMP != (Object)null && (Object)(object)((Component)youAreFiredDueToNegliganceSubtextTMP).gameObject != (Object)null) { ((Component)youAreFiredDueToNegliganceSubtextTMP).gameObject.SetActive(false); } IsEjectingDueToNegligence = false; } } public static class PluginInfo { public const string PLUGIN_GUID = "OpenDoorsInSpace"; public const string PLUGIN_NAME = "OpenDoorsInSpace"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace OpenDoorsInSpace.Patches { [HarmonyPatch] public class Patches { [HarmonyPatch(typeof(HangarShipDoor), "Update")] [HarmonyPostfix] public static void HanagerShipDoor_Update_Postfix(HangarShipDoor __instance) { if (!__instance.triggerScript.interactable && StartOfRound.Instance.inShipPhase) { Plugin.Log.LogInfo((object)"Forcing door buttons to be interactible"); __instance.triggerScript.interactable = true; } } [HarmonyPatch(typeof(HangarShipDoor), "PlayDoorAnimation")] [HarmonyPrefix] public static bool HangarShipDoor_PlayDoorAnimation_Prefix(bool closed) { if (!closed && StartOfRound.Instance.inShipPhase) { Plugin.Manager.EjectDueToNegligance(); } return true; } [HarmonyPatch(typeof(StartOfRound), "EndPlayersFiredSequenceClientRpc")] [HarmonyPrefix] public static void StartOfRound_EndPlayersFiredSequenceClientRpc_Prefix() { Plugin.Manager.ResetEjectingDueToNegligance(); } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] public static void StartOfRound_playersFiredGameOver_Enumerator_Prefix(IEnumerator<object> __instance) { FieldInfo fieldInfo = AccessTools.DeclaredField(__instance.GetType(), "<>1__state"); if ((Object)(object)Plugin.Manager != (Object)null && Plugin.Manager.IsEjectingDueToNegligence && (int)fieldInfo.GetValue(__instance) < 2) { Plugin.Log.LogInfo((object)"Skipping alarms, fired speech, and waiting time of players fired sequence"); fieldInfo.SetValue(__instance, 2); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }