using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using Gunfiguration;
using MonoMod.RuntimeDetour;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AllHarmfulEnemiesAreJammed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AllHarmfulEnemiesAreJammed")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3d6ddf62-c65f-4819-8896-5750c177cbfa")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PreventJammedCompanions;
public static class Hooks
{
internal static Gunfig _Gunfig;
internal const string PREVENT_JAMMED = "Prevent All Companions Becoming Jammed";
internal static void Init()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
_Gunfig = Gunfig.Get(GunfigHelpers.WithColor("Prevent Jammed Companions", Color.white));
_Gunfig.AddToggle("Prevent All Companions Becoming Jammed", true, (string)null, (Action<string, string>)null, (Update)0);
Hook val = new Hook((MethodBase)typeof(AIActor).GetMethod("BecomeBlackPhantom", BindingFlags.Instance | BindingFlags.Public), typeof(Hooks).GetMethod("PreventCompanionBlackPhantom", BindingFlags.Static | BindingFlags.NonPublic));
}
private static void PreventCompanionBlackPhantom(Action<AIActor> orig, AIActor self)
{
if (!_Gunfig.Enabled("Prevent All Companions Becoming Jammed") || !((Object)(object)self != (Object)null) || !((Object)(object)self.CompanionOwner != (Object)null))
{
orig(self);
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("wgowl.etg.preventjammedcompanions", "PreventJammedCompanions", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public const string GUID = "wgowl.etg.preventjammedcompanions";
public const string NAME = "PreventJammedCompanions";
public const string VERSION = "1.0.0";
public void Awake()
{
ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
}
public void GMStart(GameManager gm)
{
Hooks.Init();
}
}