using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
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("ViewExtension")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Increase the camera's culling distance")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0")]
[assembly: AssemblyProduct("ViewExtension")]
[assembly: AssemblyTitle("ViewExtension")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[BepInPlugin("ViewExtension", "ViewExtension", "1.2.0")]
public class ViewExtension : BaseUnityPlugin
{
private static Harmony _harmony;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
_harmony = new Harmony("com.yourname.ViewExtension");
_harmony.PatchAll();
ViewExtensionConfig.Init(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Logger.LogInfo((object)"View distance adjusted!");
}
}
[HarmonyPatch(typeof(PlayerControllerB), "Awake")]
public class CameraFarClipPlanePatch
{
[HarmonyPostfix]
public static void Postfix(PlayerControllerB __instance)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
if ((Object)__instance != (Object)null)
{
Camera gameplayCamera = __instance.gameplayCamera;
if ((Object)gameplayCamera != (Object)null)
{
float value = ViewExtensionConfig.FarClipPlane.Value;
gameplayCamera.farClipPlane = value;
}
}
}
}
public static class ViewExtensionConfig
{
public static ConfigEntry<float> FarClipPlane;
internal static void Init(ConfigFile config)
{
FarClipPlane = config.Bind<float>("General", "FarClipPlane", 1500f, "View distance in units. Vanilla is 400.");
if (float.IsNaN(FarClipPlane.Value) || FarClipPlane.Value <= 0f || FarClipPlane.Value >= 100000f)
{
Debug.LogWarning((object)"ViewExtension: Invalid value for FarClipPlane in the config file. Using default value of 1500.");
FarClipPlane.Value = 1500f;
}
}
}