using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [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("ActivateExtractionWithCart")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ActivateExtractionWithCart")] [assembly: AssemblyTitle("ActivateExtractionWithCart")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace ActivateExtractionWithCart { [HarmonyPatch] public class CartCollisionDetector : MonoBehaviour { private static readonly FieldInfo isShopField = typeof(ExtractionPoint).GetField("isShop", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo inStartRoomField = typeof(ExtractionPoint).GetField("inStartRoom", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo currentStateField = typeof(ExtractionPoint).GetField("currentState", BindingFlags.Instance | BindingFlags.NonPublic); private ExtractionPoint? extractionPoint; private bool IsShop => (Object)(object)extractionPoint != (Object)null && (bool)isShopField.GetValue(extractionPoint); private State CurrentState => (State)(((Object)(object)extractionPoint != (Object)null) ? ((int)(State)currentStateField.GetValue(extractionPoint)) : 0); [HarmonyPatch(typeof(ExtractionPoint), "Start")] [HarmonyPostfix] public static void OnExtractionPointStart(ExtractionPoint __instance) { if ((bool)inStartRoomField.GetValue(__instance)) { return; } StaticGrabObject[] componentsInChildren = ((Component)__instance).GetComponentsInChildren(); foreach (StaticGrabObject val in componentsInChildren) { if (((Object)val).name.StartsWith("Button")) { ((Component)val).gameObject.AddComponent().extractionPoint = __instance; Plugin.Log("CartCollisionDetector attached to extraction zone button."); return; } } Plugin.LogWarning("Could not find Button child on ExtractionPoint — CartCollisionDetector not attached."); } private void OnCollisionEnter(Collision collision) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 if (SemiFunc.IsMasterClientOrSingleplayer() && !((Object)(object)extractionPoint == (Object)null) && (int)CurrentState == 1 && !extractionPoint.isLocked && !IsShop && !((Object)(object)collision.gameObject.GetComponent() == (Object)null)) { Plugin.Log("Cart collided with extraction button — triggering OnClick."); extractionPoint.OnClick(); } } } [BepInPlugin("napp.ActivateExtractionWithCart", "ActivateExtractionWithCart", "1.0.0")] public class Plugin : BaseUnityPlugin { private Harmony? _harmony; private static ManualLogSource? _logger; private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown _logger = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("napp.ActivateExtractionWithCart"); _harmony.PatchAll(); Log("ActivateExtractionWithCart loaded."); } internal static void Log(string msg) { ManualLogSource? logger = _logger; if (logger != null) { logger.LogInfo((object)msg); } } internal static void LogWarning(string msg) { ManualLogSource? logger = _logger; if (logger != null) { logger.LogWarning((object)msg); } } internal static void LogError(string msg) { ManualLogSource? logger = _logger; if (logger != null) { logger.LogError((object)msg); } } } public static class PluginInfo { public const string PLUGIN_GUID = "ActivateExtractionWithCart"; public const string PLUGIN_NAME = "ActivateExtractionWithCart"; public const string PLUGIN_VERSION = "1.0.0"; } }