Please disclose if your mod was created primarily 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 Habitat Interior v1.1.3
Interior.dll
Decompiled 6 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using DunGen; using HarmonyLib; using Interior.Helpers; using Interior.NetcodePatcher; using Interior.Patches; using LethalLevelLoader; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Interior")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+530c0a7947ec5203f8aca7220dabeec02f6f66d2")] [assembly: AssemblyProduct("Interior")] [assembly: AssemblyTitle("Interior")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 Interior { [BepInPlugin("mborsh.HabitatIntreior", "HabitatInterior", "1.1.0")] internal class Plugin : BaseUnityPlugin { public const string modGUID = "mborsh.HabitatIntreior"; public const string modName = "HabitatInterior"; public const string modVersion = "1.1.0"; public static Plugin Instance = null; internal static ManualLogSource mls = null; internal static readonly Harmony harmony = new Harmony("mborsh.HabitatIntreior"); private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = ((BaseUnityPlugin)this).Logger; NetcodePatcher(); harmony.PatchAll(typeof(Centipede)); mls.LogInfo((object)"HabitatInterior Interior Plugin loaded!"); } private static void NetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } } namespace Interior.Scripts { public class ApparatusMachineThing : NetworkBehaviour { public static ApparatusMachineThing Instance; public LungPropExtension lungProp = null; public int leverCount = 4; public Animator animator = null; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Instance = this; } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); Instance = null; } public void SendLeverOpen() { SendLeverOpenServerRpc(); } [ServerRpc(RequireOwnership = false)] public void SendLeverOpenServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1954329279u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1954329279u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; leverCount--; if (leverCount == 0) { SendLeverOpenClientRpc(); } } } [ClientRpc] public void SendLeverOpenClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1084562974u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1084562974u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; animator.SetTrigger("OpenShell"); if ((Object)(object)lungProp != (Object)null) { ((GrabbableObject)lungProp).grabbable = true; ((GrabbableObject)lungProp).grabbableToEnemies = true; } else { Plugin.mls.LogError((object)"Something wrong with apparatus machine/apparatus script!!! Report that to creator of this interior please."); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1954329279u, new RpcReceiveHandler(__rpc_handler_1954329279), "SendLeverOpenServerRpc"); ((NetworkBehaviour)this).__registerRpc(1084562974u, new RpcReceiveHandler(__rpc_handler_1084562974), "SendLeverOpenClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1954329279(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ApparatusMachineThing)(object)target).SendLeverOpenServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1084562974(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ApparatusMachineThing)(object)target).SendLeverOpenClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ApparatusMachineThing"; } } internal class LampsRandomizer : MonoBehaviour { public Animator? lampAnimator; [Range(0f, 100f)] public float onStartChance; private void Start() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)lampAnimator == (Object)null) && (float)(Randomizer.Instance.rnd.Next(100) + 1) <= onStartChance) { lampAnimator.SetBool("on", false); Plugin.mls.LogInfo((object)$"Disabling lamp: {((Object)((Component)lampAnimator).gameObject).name}, with chance: {onStartChance} at {((Component)lampAnimator).transform.position}"); } } } public class LungPropExtension : LungProp { [Space(10f)] public AudioSource? apparatusAudio; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private static EnemyType? <oldBirdEnemyType>k__BackingField; public static EnemyType? oldBirdEnemyType { get { if ((Object)(object)<oldBirdEnemyType>k__BackingField == (Object)null) { oldBirdEnemyType = OriginalContent.Enemies.Find((EnemyType enemy) => string.CompareOrdinal(enemy.enemyName, "RadMech") == 0); } return <oldBirdEnemyType>k__BackingField; } [CompilerGenerated] private set { <oldBirdEnemyType>k__BackingField = value; } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Plugin.mls.LogInfo((object)"LungPropExtension spawned!"); if (!StartOfRound.Instance.inShipPhase) { ((MonoBehaviour)this).StartCoroutine(WaitAndDoSmth()); } } private IEnumerator WaitAndDoSmth() { yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)ApparatusMachineThing.Instance != (Object)null)); Plugin.mls.LogInfo((object)"ApparatusMachineThing instance found!"); ApparatusMachineThing.Instance.lungProp = this; ((GrabbableObject)this).grabbable = false; ((GrabbableObject)this).grabbableToEnemies = false; base.isLungDocked = true; base.isLungPowered = true; base.radMechEnemyType = oldBirdEnemyType; if ((Object)(object)apparatusAudio != (Object)null) { apparatusAudio.loop = true; apparatusAudio.Play(); } } protected override void __initializeVariables() { ((LungProp)this).__initializeVariables(); } protected override void __initializeRpcs() { ((LungProp)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "LungPropExtension"; } } public class MaterialRandomizer : MonoBehaviour { public List<Material> materials = new List<Material>(); public MeshRenderer? meshRenderer; private void Start() { if (materials.Count != 0) { if ((Object)(object)meshRenderer == (Object)null) { meshRenderer = ((Component)this).GetComponent<MeshRenderer>(); } ((Renderer)meshRenderer).material = materials[Randomizer.Instance.rnd.Next(materials.Count)]; } } } internal class OnStartRandom : MonoBehaviour { public UnityEvent? onStart; [Range(0f, 100f)] public float onStartChance; private void Start() { if ((float)(Randomizer.Instance.rnd.Next(100) + 1) <= onStartChance) { onStart.Invoke(); } } } public class SphereBlockerChecker : MonoBehaviour { public List<Doorway> doorways = new List<Doorway>(); private void Start() { foreach (Doorway doorway in doorways) { if (Object.op_Implicit((Object)(object)doorway) && Object.op_Implicit((Object)(object)doorway.connectedDoorway) && (Object)(object)doorway.tile.placement.tileSet == (Object)(object)doorway.connectedDoorway.tile.placement.tileSet) { Object.Destroy((Object)(object)doorway.ConnectorSceneObjects[0]); } } } } } namespace Interior.Patches { internal class Centipede { [HarmonyTranspiler] [HarmonyPatch(typeof(CentipedeAI), "RaycastToCeiling")] private static IEnumerable<CodeInstruction> RaycastToCeilingPatch(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)20f, (string)null) }).SetInstruction(new CodeInstruction(OpCodes.Ldc_R4, (object)80f)); return val.InstructionEnumeration(); } [HarmonyTranspiler] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static IEnumerable<CodeInstruction> FallFromCeilingPatch(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)20f, (string)null) }).SetInstruction(new CodeInstruction(OpCodes.Ldc_R4, (object)80f)); return val.InstructionEnumeration(); } } } namespace Interior.Helpers { internal class Randomizer { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private static Randomizer? <Instance>k__BackingField; internal Random rnd { get; private set; } internal static Randomizer? Instance { get { if (<Instance>k__BackingField == null) { Instance = new Randomizer(); } return <Instance>k__BackingField; } [CompilerGenerated] private set { <Instance>k__BackingField = value; } } private Randomizer() { rnd = new Random(StartOfRound.Instance.randomMapSeed + 69); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace Interior.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }