diff --git a/CameraResolutionScale/Plugin.cs b/CameraResolutionScale/Plugin.cs index 1d7af91..fc16e0c 100644 --- a/CameraResolutionScale/Plugin.cs +++ b/CameraResolutionScale/Plugin.cs @@ -6,9 +6,7 @@ using EFT; using EFT.Settings.Graphics; using System.Collections; using System.ComponentModel; -using System.Reflection; using UnityEngine; -using UnityEngine.Rendering.PostProcessing; /* Dependencies: * ../BepInEx/core/ @@ -30,7 +28,7 @@ namespace ScopeTweaks public class Plugin : BaseUnityPlugin { ConfigEntry scopeCameraResolutionScale; - ConfigEntry scopeFixType; + //ConfigEntry scopeFixType; ConfigEntry enableDebug; enum EFOVScalingMode @@ -63,11 +61,11 @@ namespace ScopeTweaks 80, new ConfigDescription("Additional override applied on top of currently enabled resolution scaling method.", new AcceptableValueRange(10, 100))); - scopeFixType = Config.Bind( - "General", - "High FOV sight tweak", - EFOVScalingMode.ScopesOnly, - new ConfigDescription("")); + //scopeFixType = Config.Bind( + //"General", + //"High FOV sight tweak", + //EFOVScalingMode.ScopesOnly, + //new ConfigDescription("")); enableDebug = Config.Bind("Debug", "Enable debug logging", false); } @@ -78,6 +76,34 @@ namespace ScopeTweaks if (Singleton.Instance == null) return; GameStatus currentGameState = Singleton.Instance.Status; + if (mainPlayer != null) + { + if (Input.GetKeyDown("[")) + { + StopAllCoroutines(); + CameraClass.Instance.SetFov(35, 1.0f, true); + } + + if (Input.GetKeyDown("]")) + { + StopAllCoroutines(); + CameraClass.Instance.SetFov(defaultInGameFOV, 1.0f, true); + } + } + + //if (mainPlayer != null && mainPlayer.ProceduralWeaponAnimation.IsAiming) + //{ + // if (Input.GetMouseButtonDown(0)) + // { + // inGameFOV = 50; + // } + + // if (Input.GetMouseButtonUp(0)) + // { + // inGameFOV = defaultInGameFOV; + // } + //} + //logic should only execute once per game instead of every frame if (!gameStateChanged(currentGameState)) return; @@ -94,7 +120,6 @@ namespace ScopeTweaks StartCoroutine(tryGetScopeCamera()); defaultInGameFOV = inGameFOV; - break; } case GameStatus.SoftStopping: @@ -148,12 +173,10 @@ namespace ScopeTweaks get { int fov = Singleton.Instance.Game.Settings.FieldOfView.Value; - if (enableDebug.Value) Logger.LogInfo($"get_defaultInGameFOV: Reading from settings: {fov}"); return fov; } set { - if (enableDebug.Value) Logger.LogInfo($"set_defaultInGameFOV: Writing to settings: {value}"); Singleton.Instance.Game.Settings.FieldOfView.Value = value; } } @@ -198,6 +221,7 @@ namespace ScopeTweaks /// /// PLAYER WEAPON EVENTS /// + void subscribeHandsChangedEvent() { if (enableDebug.Value) Logger.LogInfo("Subscribing to HandsChanged Event"); @@ -214,41 +238,41 @@ namespace ScopeTweaks { currentScalingFactor = getCurrentScalingFactor(); StartCoroutine(tryGetScopeCamera()); - - if (!mainPlayer.ProceduralWeaponAnimation.IsAiming) - { - float aimSpeed = 0.7f * mainPlayer.ProceduralWeaponAnimation.AimingSpeed; - switch (scopeFixType.Value) - { - case EFOVScalingMode.Disabled: - { - break; - } - case EFOVScalingMode.ScopesOnly: - { - if (mainPlayer.ProceduralWeaponAnimation.CurrentScope.IsOptic) - { - //setFovLibrary.SetFov(defaultInGameFOV, aimSpeed, false); - inGameFOV = defaultInGameFOV; + //if (!mainPlayer.ProceduralWeaponAnimation.IsAiming) + //{ + // float aimSpeed = 0.7f * mainPlayer.ProceduralWeaponAnimation.AimingSpeed; - mainPlayer.ProceduralWeaponAnimation.ResetFovAdjustments(mainPlayer); - } + // switch (scopeFixType.Value) + // { + // case EFOVScalingMode.Disabled: + // { + // break; + // } + // case EFOVScalingMode.ScopesOnly: + // { + // if (mainPlayer.ProceduralWeaponAnimation.CurrentScope.IsOptic) + // { + // inGameFOV = defaultInGameFOV; + // StopAllCoroutines(); + // setFovLibrary.SetFov(defaultInGameFOV, aimSpeed, true); + // //mainPlayer.ProceduralWeaponAnimation.ApplyFovAdjustments(mainPlayer); + // } - break; - } - case EFOVScalingMode.All: - { - //setFovLibrary.SetFov(defaultInGameFOV, aimSpeed, false); - inGameFOV = defaultInGameFOV; + // break; + // } + // case EFOVScalingMode.All: + // { + // inGameFOV = defaultInGameFOV; + // StopAllCoroutines(); + // setFovLibrary.SetFov(defaultInGameFOV, aimSpeed, true); + // //mainPlayer.ProceduralWeaponAnimation.ApplyFovAdjustments(mainPlayer); - mainPlayer.ProceduralWeaponAnimation.ResetFovAdjustments(mainPlayer); - - break; - } - } - return; - } + // break; + // } + // } + // return; + //} if (mainPlayer.ProceduralWeaponAnimation.IsAiming) { @@ -258,26 +282,26 @@ namespace ScopeTweaks setScopeCameraResolutionScale(scopeCameraResolutionScale.Value); defaultInGameFOV = inGameFOV; - switch (scopeFixType.Value) - { - case EFOVScalingMode.Disabled: - { - break; - } - case EFOVScalingMode.ScopesOnly: - { - if (mainPlayer.ProceduralWeaponAnimation.CurrentScope.IsOptic) - { - forceADSFOV(); - } - break; - } - case EFOVScalingMode.All: - { - forceADSFOV(); - break; - } - } + //switch (scopeFixType.Value) + //{ + // case EFOVScalingMode.Disabled: + // { + // break; + // } + // case EFOVScalingMode.ScopesOnly: + // { + // if (mainPlayer.ProceduralWeaponAnimation.CurrentScope.IsOptic) + // { + // forceADSFOV(); + // } + // break; + // } + // case EFOVScalingMode.All: + // { + // forceADSFOV(); + // break; + // } + //} } }; } @@ -290,7 +314,7 @@ namespace ScopeTweaks //Doesn't take effect if Fontaine's FOV Fix is loaded. if (!Chainloader.PluginInfos.ContainsKey("FOVFix")) - { + { setFovLibrary.SetFov(35, aimSpeed, false); inGameFOV = 50; } diff --git a/CameraResolutionScale/notGreg.ScopeTweaks.csproj b/CameraResolutionScale/notGreg.ScopeTweaks.csproj index 5595627..dec7cb0 100644 --- a/CameraResolutionScale/notGreg.ScopeTweaks.csproj +++ b/CameraResolutionScale/notGreg.ScopeTweaks.csproj @@ -60,6 +60,10 @@ E:\SPT-AKI\SPT-AKI 3.5.3\EscapeFromTarkov_Data\Managed\UnityEngine.CoreModule.dll + + False + E:\SPT-AKI\SPT-AKI 3.5.3\EscapeFromTarkov_Data\Managed\UnityEngine.InputLegacyModule.dll + \ No newline at end of file