Decompiled source of LethalFOV v1.0.0

LethalFOV.dll

Decompiled 4 hours ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
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("LethalFOV")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalFOV")]
[assembly: AssemblyTitle("LethalFOV")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LethalFov;

[BepInPlugin("LethalFOV", "LethalFOV", "1.0.0")]
public class Main : BaseUnityPlugin
{
	public static ConfigEntry<float> configFOV;

	private void Awake()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		configFOV = ((BaseUnityPlugin)this).Config.Bind<float>("Config", "FOV", 66f, "Changes Field of View");
		new Harmony("LethalFOV").PatchAll();
	}
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
public class PlayerControllerBPatch
{
	[HarmonyPrefix]
	private static void Prefix(PlayerControllerB __instance)
	{
		((Component)__instance.localVisor).gameObject.SetActive(false);
		if (__instance.inTerminalMenu)
		{
			__instance.targetFOV = 60f;
		}
		else if (__instance.IsInspectingItem)
		{
			__instance.targetFOV = 46f;
		}
		else if (__instance.isSprinting)
		{
			__instance.targetFOV = Main.configFOV.Value + 2f;
		}
		else
		{
			__instance.targetFOV = Main.configFOV.Value;
		}
		__instance.gameplayCamera.fieldOfView = Mathf.Lerp(__instance.gameplayCamera.fieldOfView, __instance.targetFOV, 6f * Time.deltaTime);
	}
}