diff --git a/ClientMod/ClearVisionPatches.cs b/ClientMod/ClearVisionPatches.cs index 61678da..6a88c21 100644 --- a/ClientMod/ClearVisionPatches.cs +++ b/ClientMod/ClearVisionPatches.cs @@ -13,13 +13,68 @@ namespace ClearVision { [PatchPostfix] static void Postfix() { - // Get Camera - GameObject maincam = GameObject.Find("FPS Camera"); - NightVision nv = maincam.GetComponent(); - bool isNVGOn = nv.On; - if(isNVGOn) { - nv.Mask = nv.AnvisMaskTexture; - nv.Intensity = Plugin.GPIntensity.Value; + Debug.LogError("GogglesPatches Postfix()"); + if(Plugin.GlobalEnabled.Value) { // sanity check + // Get Camera + GameObject maincam = GameObject.Find("FPS Camera"); + NightVision nv = maincam.GetComponent(); + CC_Vintage vintage = maincam.GetComponent(); + if(nv.On || nv.InProcessSwitching) { + // Apply each individual setting depending on original texmask, hence why we cannot change it, but rather disable it. + if(nv.TextureMask.Mask == nv.AnvisMaskTexture) { + nv.Intensity = Plugin.GPIntensity.Value; + nv.NoiseIntensity = Plugin.GPNoiseIntensity.Value; + nv.NoiseScale = Plugin.GPNoiseScale.Value; + if (Plugin.GPMaskEnabled.Value) { + nv.TextureMask.enabled = true; + nv.TextureMask.Size = Plugin.GPMaskSize.Value; + } + else { + nv.TextureMask.enabled = false; + } + nv.Color = Plugin.GPColor.Value; + } + else if (nv.TextureMask.Mask == nv.BinocularMaskTexture) { + nv.Intensity = Plugin.GPIntensity.Value; + nv.NoiseIntensity = Plugin.GPNoiseIntensity.Value; + nv.NoiseScale = Plugin.GPNoiseScale.Value; + if (Plugin.GPMaskEnabled.Value) { + nv.TextureMask.enabled = true; + nv.TextureMask.Size = Plugin.GPMaskSize.Value; + } + else { + nv.TextureMask.enabled = false; + } + nv.Color = Plugin.GPColor.Value; + } + else if (nv.TextureMask.Mask == nv.OldMonocularMaskTexture) { + nv.Intensity = Plugin.GPIntensity.Value; + nv.NoiseIntensity = Plugin.GPNoiseIntensity.Value; + nv.NoiseScale = Plugin.GPNoiseScale.Value; + if (Plugin.GPMaskEnabled.Value) { + nv.TextureMask.enabled = true; + nv.TextureMask.Size = Plugin.GPMaskSize.Value; + } + else { + nv.TextureMask.enabled = false; + } + nv.Color = Plugin.GPColor.Value; + } + else { // makes any other exception to the above be noiseless, but still otherwise vanilla. + nv.Intensity = 2.3f; + nv.NoiseIntensity = 0.0f; + nv.NoiseScale = 0.0f; + nv.TextureMask.enabled = true; + nv.TextureMask.Size = 1.2f; + // color left default + } + vintage.enabled = false; + return; + } + else { + vintage.enabled = true; + return; + } } } } @@ -34,7 +89,40 @@ namespace ClearVision { [PatchPostfix] static void Postfix() { - // + Debug.LogError("ScopePatches Postfix()"); + if(Plugin.GlobalEnabled.Value) { // sanity check + // Get Camera + GameObject maincam = GameObject.Find("FPS Camera"); + ThermalVision t7 = maincam.GetComponent(); + CC_Vintage vintage = maincam.GetComponent(); + // Get BaseOpticScope(Clone) obj + GameObject scope = GameObject.FindGameObjectWithTag("OpticCamera"); + ThermalVision thermal = scope.GetComponent(); + + if(t7.On) { + t7.IsGlitch = Plugin.T7Glitch.Value; + t7.IsPixelated = Plugin.T7Pixel.Value; + t7.IsNoisy = Plugin.T7Glitch.Value; + t7.IsFpsStuck = Plugin.T7Glitch.Value; + if (Plugin.T7Glitch.Value) { + t7.StuckFpsUtilities.MaxFramerate = Plugin.T7FpsMax.Value; + t7.StuckFpsUtilities.MinFramerate = Plugin.T7FpsMax.Value; + } + t7.TextureMask.Size = Plugin.T7MaskSize.Value; + vintage.enabled = false; + // no idea how to change the clip plane distance, YET. + } + else if (thermal.On && !t7.On) { // Make sure the thermal headgear isn't on, no need to do worthless changes. + //how do I determine which scope is which FUCK + vintage.enabled = false; + } + else { + vintage.enabled = true; + return; + } + } + else + return; } } } \ No newline at end of file diff --git a/ClientMod/Plugin.cs b/ClientMod/Plugin.cs index 0ec5fd7..b786aa8 100644 --- a/ClientMod/Plugin.cs +++ b/ClientMod/Plugin.cs @@ -1,10 +1,6 @@ -using Aki.Reflection.Patching; -using BepInEx; +using BepInEx; using BepInEx.Configuration; -using System.Reflection; using UnityEngine; -using EFT; -using System.Threading.Tasks; namespace ClearVision { [BepInPlugin("com.LimboFPS.ClearVision", "ClearVision", "1.0.0")] @@ -62,7 +58,7 @@ namespace ClearVision { public static ConfigEntry T7MaskEnabled { get; set; } public static ConfigEntry T7MaskSize { get; set; } - // REAP-IR WhiteHot/BlackHot Thermal + // REAP-IR Thermal public static ConfigEntry IREnabled { get; set; } public static ConfigEntry IRGlitch { get; set; } public static ConfigEntry IRNoise { get; set; }