Decompiled source of DspEnemyThreat v1.0.1

DspEnemyThreat.dll

Decompiled 10 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using JetBrains.Annotations;
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(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace DspEnemyThreat;

[BepInPlugin("DspEnemyThreat_configuration", "DspEnemyThreat", "1.0")]
public class DspEnemyThreat : BaseUnityPlugin
{
	private const string PluginGuid = "DspEnemyThreat_configuration";

	private const string PluginName = "DspEnemyThreat";

	private const string PluginVersion = "1.0";

	public static bool IsActive;

	private void Awake()
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogWarning((object)"DspEnemyThreat is loaded!");
		((BaseUnityPlugin)this).Logger.LogWarning((object)string.Format("{0} Enemy state: {1}", "DspEnemyThreat", IsActive));
		Harmony val = new Harmony("DspEnemyThreat");
		val.PatchAll();
	}

	private void Update()
	{
		if (Input.GetKeyDown((KeyCode)288))
		{
			IsActive = !IsActive;
			((BaseUnityPlugin)this).Logger.LogWarning((object)string.Format("{0} Enemy state changed: {1}", "DspEnemyThreat", IsActive));
		}
	}
}
[HarmonyPatch(typeof(DFGBaseComponent), "UpdateFactoryThreat")]
public static class ThreatOverride1
{
	[UsedImplicitly]
	public static bool Prefix()
	{
		return DspEnemyThreat.IsActive;
	}
}
[HarmonyPatch(typeof(EnemyDFHiveSystem), "KeyTickLogic")]
public static class ThreatOverride2
{
	[UsedImplicitly]
	public static bool Prefix(EnemyDFHiveSystem __instance)
	{
		if (!DspEnemyThreat.IsActive)
		{
			__instance.evolve.threat = 0;
			return false;
		}
		return true;
	}
}