using 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 CG.Ship.Hull;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("OpenShipDoors")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template")]
[assembly: AssemblyFileVersion("0.0.2.0")]
[assembly: AssemblyInformationalVersion("0.0.2")]
[assembly: AssemblyProduct("OpenShipDoors")]
[assembly: AssemblyTitle("OpenShipDoors")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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 OpenShipDoors
{
[HarmonyPatch(typeof(AbstractDoor), "Awake")]
internal class AbstractDoorPatch
{
private static void Prefix(AbstractDoor __instance, ref bool ___isOpen)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Invalid comparison between Unknown and I4
if (!BepinPlugin.Bindings.OpenDoorsOnStart.Value)
{
return;
}
AirlockDoor val = (AirlockDoor)(object)((__instance is AirlockDoor) ? __instance : null);
if (val != null)
{
if ((BepinPlugin.Bindings.OpenInnerAirlock.Value && (int)val.airlockDoorType == 0) || (BepinPlugin.Bindings.OpenOuterAirlock.Value && (int)val.airlockDoorType == 1))
{
___isOpen = true;
}
}
else
{
___isOpen = true;
}
}
}
[BepInPlugin("OpenShipDoors", "OpenShipDoors", "0.0.2")]
[BepInProcess("Void Crew.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BepinPlugin : BaseUnityPlugin
{
internal class Bindings
{
internal static ConfigEntry<bool> OpenDoorsOnStart;
internal static ConfigEntry<bool> OpenInnerAirlock;
internal static ConfigEntry<bool> OpenOuterAirlock;
}
internal static ManualLogSource Log;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin OpenShipDoors is loaded!");
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "OpenShipDoors");
Bindings.OpenDoorsOnStart = ((BaseUnityPlugin)this).Config.Bind<bool>("OpenShipDoors", "OpenShipDoorsOnStart", true, (ConfigDescription)null);
Bindings.OpenInnerAirlock = ((BaseUnityPlugin)this).Config.Bind<bool>("OpenShipDoors", "OpenInnerAirlock", true, (ConfigDescription)null);
Bindings.OpenOuterAirlock = ((BaseUnityPlugin)this).Config.Bind<bool>("OpenShipDoors", "OpenOuterAirlock", false, (ConfigDescription)null);
}
}
internal class GUI : ModSettingsMenu
{
public override void Draw()
{
if (GUILayout.Button("Open ship doors on start: " + (BepinPlugin.Bindings.OpenDoorsOnStart.Value ? "Enabled" : "Disabled"), Array.Empty<GUILayoutOption>()))
{
BepinPlugin.Bindings.OpenDoorsOnStart.Value = !BepinPlugin.Bindings.OpenDoorsOnStart.Value;
}
if (GUILayout.Button("Open inner airlock doors: " + (BepinPlugin.Bindings.OpenInnerAirlock.Value ? "Enabled" : "Disabled"), Array.Empty<GUILayoutOption>()))
{
BepinPlugin.Bindings.OpenInnerAirlock.Value = !BepinPlugin.Bindings.OpenInnerAirlock.Value;
}
if (GUILayout.Button("Open outer airlock doors: " + (BepinPlugin.Bindings.OpenOuterAirlock.Value ? "Enabled" : "Disabled"), Array.Empty<GUILayoutOption>()))
{
BepinPlugin.Bindings.OpenOuterAirlock.Value = !BepinPlugin.Bindings.OpenOuterAirlock.Value;
}
}
public override string Name()
{
return "OpenShipDoors: " + (BepinPlugin.Bindings.OpenDoorsOnStart.Value ? "Enabled" : "Disabled");
}
}
public class VoidManagerPlugin : VoidPlugin
{
public override MultiplayerType MPType => (MultiplayerType)3;
public override string Author => "18107, Dragon";
public override string Description => "Opens ship doors on game startup. Host-Side";
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "OpenShipDoors";
public const string PLUGIN_NAME = "OpenShipDoors";
public const string PLUGIN_VERSION = "0.0.2";
}
}