Decompiled source of modpack camera v0.0.4

plugins/valheim_orbital_camera.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("valheim_orbital_camera")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("valheim_orbital_camera")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6DA0F241-7F0F-4C27-B48D-41DD61F2BE04")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace valheim_orbital_camera;

[BepInPlugin("de.torbilicious", "valheim-orbital-camera", "1.1.1")]
[BepInProcess("valheim.exe")]
public class OrbitalCameraMod : BaseUnityPlugin
{
	[HarmonyPatch(typeof(GameCamera), "LateUpdate")]
	private class Camera_Patch
	{
		private static void Prefix(ref float ___m_maxDistance, ref float ___m_fov)
		{
			if (patchPending)
			{
				Debug.Log((object)$"Previous max Camera Distance: {___m_maxDistance}");
				___m_maxDistance = newMaxCameraDistance.Value;
				Debug.Log((object)$"Patched max Camera Distance:  {___m_maxDistance}");
				Debug.Log((object)$"Previous FOV: {___m_fov}");
				___m_fov = newFov.Value;
				Debug.Log((object)$"Patched FOV:  {___m_fov}");
				patchPending = false;
			}
		}
	}

	private readonly Harmony harmony = new Harmony("de.torbilicious.valheim-orbital-camera");

	private static ConfigEntry<float> newMaxCameraDistance;

	private static ConfigEntry<float> newFov;

	private static bool patchPending = true;

	private void Awake()
	{
		newMaxCameraDistance = ((BaseUnityPlugin)this).Config.Bind<float>("valheim-orbital-camera", "newMaxCameraDistance", 90f, "Max Camera Distance To Patch");
		newMaxCameraDistance.SettingChanged += delegate
		{
			patchPending = true;
		};
		newFov = ((BaseUnityPlugin)this).Config.Bind<float>("valheim-orbital-camera", "newFov", 65f, "New FOV");
		newFov.SettingChanged += delegate
		{
			patchPending = true;
		};
		harmony.PatchAll();
	}
}