diff --git a/ClientMod/ClearVisionPatches.cs b/ClientMod/ClearVisionPatches.cs index 6a88c21..7f4d83f 100644 --- a/ClientMod/ClearVisionPatches.cs +++ b/ClientMod/ClearVisionPatches.cs @@ -6,68 +6,30 @@ using System.Reflection; namespace ClearVision { public class GogglesPatches : ModulePatch { protected override MethodBase GetTargetMethod() { - Debug.LogError("GogglesPatches GTM()"); var result = typeof(NightVision).GetMethod("method_1", BindingFlags.Instance | BindingFlags.NonPublic); return result; } [PatchPostfix] static void Postfix() { - 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.Intensity = Plugin.NVGIntensity.Value; + nv.NoiseIntensity = Plugin.NVGNoiseIntensity.Value; + nv.NoiseScale = Plugin.NVGNoiseScale.Value; + if (Plugin.NVGMaskEnabled.Value) { nv.TextureMask.enabled = true; - nv.TextureMask.Size = 1.2f; - // color left default + nv.TextureMask.Size = Plugin.NVGMaskSize.Value; } + else { + nv.TextureMask.enabled = false; + } + nv.Color = Plugin.NVGColor.Value; + vintage.enabled = false; return; } @@ -112,8 +74,15 @@ namespace ClearVision { 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 + if (thermal.On && !t7.On) { // Make sure the thermal headgear isn't on, no need to do worthless changes. + thermal.IsGlitch = Plugin.ThermalGlitch.Value; + thermal.IsPixelated = Plugin.ThermalPixel.Value; + thermal.IsNoisy = Plugin.ThermalGlitch.Value; + thermal.IsFpsStuck = Plugin.ThermalGlitch.Value; + if (Plugin.ThermalGlitch.Value) { + thermal.StuckFpsUtilities.MaxFramerate = Plugin.ThermalFpsMax.Value; + thermal.StuckFpsUtilities.MinFramerate = Plugin.ThermalFpsMax.Value; + } vintage.enabled = false; } else { diff --git a/ClientMod/Plugin.cs b/ClientMod/Plugin.cs index b786aa8..f58d181 100644 --- a/ClientMod/Plugin.cs +++ b/ClientMod/Plugin.cs @@ -7,45 +7,15 @@ namespace ClearVision { public class Plugin : BaseUnityPlugin { public static ConfigEntry GlobalEnabled { get; set; } - // GPNVG-18 - public static ConfigEntry GPEnabled { get; set; } - public static ConfigEntry GPIntensity { get; set; } - public static ConfigEntry GPNoiseIntensity { get; set; } - public static ConfigEntry GPNoiseScale { get; set; } - public static ConfigEntry GPDiffuseIntensity { get; set; } - public static ConfigEntry GPMaskEnabled { get; set; } - public static ConfigEntry GPMaskSize { get; set; } - public static ConfigEntry GPColor { get; set; } - - // PNV-10T - public static ConfigEntry PNVEnabled { get; set; } - public static ConfigEntry PNVIntensity { get; set; } - public static ConfigEntry PNVNoiseIntensity { get; set; } - public static ConfigEntry PNVNoiseScale { get; set; } - public static ConfigEntry PNVDiffuseIntensity { get; set; } - public static ConfigEntry PNVMaskEnabled { get; set; } - public static ConfigEntry PNVMaskSize { get; set; } - public static ConfigEntry PNVColor { get; set; } - - // Armasight N-15 - public static ConfigEntry N15Enabled { get; set; } - public static ConfigEntry N15Intensity { get; set; } - public static ConfigEntry N15NoiseIntensity { get; set; } - public static ConfigEntry N15NoiseScale { get; set; } - public static ConfigEntry N15DiffuseIntensity { get; set; } - public static ConfigEntry N15MaskEnabled { get; set; } - public static ConfigEntry N15MaskSize { get; set; } - public static ConfigEntry N15Color { get; set; } - - // PVS-14 Night Vision Monocular - public static ConfigEntry PVSEnabled { get; set; } - public static ConfigEntry PVSIntensity { get; set; } - public static ConfigEntry PVSNoiseIntensity { get; set; } - public static ConfigEntry PVSNoiseScale { get; set; } - public static ConfigEntry PVSDiffuseIntensity { get; set; } - public static ConfigEntry PVSMaskEnabled { get; set; } - public static ConfigEntry PVSMaskSize { get; set; } - public static ConfigEntry PVSColor { get; set; } + // NVG Sights + public static ConfigEntry NVGEnabled { get; set; } + public static ConfigEntry NVGIntensity { get; set; } + public static ConfigEntry NVGNoiseIntensity { get; set; } + public static ConfigEntry NVGNoiseScale { get; set; } + public static ConfigEntry NVGDiffuseIntensity { get; set; } + public static ConfigEntry NVGMaskEnabled { get; set; } + public static ConfigEntry NVGMaskSize { get; set; } + public static ConfigEntry NVGColor { get; set; } // T-7 Thermal Goggles public static ConfigEntry T7Enabled { get; set; } @@ -58,82 +28,28 @@ namespace ClearVision { public static ConfigEntry T7MaskEnabled { get; set; } public static ConfigEntry T7MaskSize { get; set; } - // REAP-IR Thermal - public static ConfigEntry IREnabled { get; set; } - public static ConfigEntry IRGlitch { get; set; } - public static ConfigEntry IRNoise { get; set; } - public static ConfigEntry IRPixel { get; set; } - public static ConfigEntry IRFps { get; set; } - public static ConfigEntry IRFpsMax { get; set; } - public static ConfigEntry IRMotionBlur { get; set; } - - // FLIR RS-32 Thermal - public static ConfigEntry RS32Enabled { get; set; } - public static ConfigEntry RS32Glitch { get; set; } - public static ConfigEntry RS32Noise { get; set; } - public static ConfigEntry RS32Pixel { get; set; } - public static ConfigEntry RS32Fps { get; set; } - public static ConfigEntry RS32FpsMax { get; set; } - public static ConfigEntry RS32MotionBlur { get; set; } - - // Torrey Pines Logic T12 30Hz - public static ConfigEntry T12Enabled { get; set; } - public static ConfigEntry T12Glitch { get; set; } - public static ConfigEntry T12Noise { get; set; } - public static ConfigEntry T12Pixel { get; set; } - public static ConfigEntry T12Fps { get; set; } - public static ConfigEntry T12FpsMax { get; set; } - public static ConfigEntry T12MotionBlur { get; set; } - - // MP-155 Ultima Camera - public static ConfigEntry UltimaEnabled { get; set; } - public static ConfigEntry UltimaGlitch { get; set; } - public static ConfigEntry UltimaNoise { get; set; } - public static ConfigEntry UltimaPixel { get; set; } - public static ConfigEntry UltimaFps { get; set; } - public static ConfigEntry UltimaFpsMax { get; set; } - public static ConfigEntry UltimaMotionBlur { get; set; } + // All Thermal Sights + public static ConfigEntry ThermalEnabled { get; set; } + public static ConfigEntry ThermalGlitch { get; set; } + public static ConfigEntry ThermalNosie { get; set; } + public static ConfigEntry ThermalPixel { get; set; } + public static ConfigEntry ThermalFpsLock { get; set; } + public static ConfigEntry ThermalFpsMax { get; set; } + public static ConfigEntry ThermalMotionBlur { get; set; } private void Start() { Debug.LogError("ClearVision Start()"); GlobalEnabled = Config.Bind("ClearVision", "GlobalEnabled", true, new ConfigDescription("Main Toggle", null)); // Night Vision Goggles // GPNVG-18 Goggles - GPEnabled = Config.Bind("GPNVG", "GPEnabled", true, new ConfigDescription("Enable GPNVG-18", null)); - GPIntensity = Config.Bind("GPNVG", "GPIntensity", 2.3f, new ConfigDescription("NVG Intensity", null)); - GPNoiseIntensity = Config.Bind("GPNVG", "GPNoiseIntensity", 0.0f, new ConfigDescription("NVG Noise Intensity", null)); - GPNoiseScale = Config.Bind("GPNVG", "GPNoiseScale", 0.0f, new ConfigDescription("NVG Noise Scale", null)); - GPDiffuseIntensity = Config.Bind("GPNVG", "GPDiffuseIntensity", 0.0f, new ConfigDescription("NVG Diffuse Intensity", null)); - GPMaskEnabled = Config.Bind("GPNVG", "GPMaskEnabled", true, new ConfigDescription("NVG Mask Overlay", null)); - GPMaskSize = Config.Bind("GPNVG", "GPMaskSize", 1.2f, new ConfigDescription("NVG Mask Overlay Size", null)); - GPColor = Config.Bind("GPNVG", "GPColor", new Color(0.00f, 0.78f, 0.78f, 0.99f), new ConfigDescription("NVG Color", null)); - // PNV-10T Goggles - PNVEnabled = Config.Bind("PNV", "PNVEnabled", true, new ConfigDescription("Enable PNV-10", null)); - PNVIntensity = Config.Bind("PNV", "PNVIntensity", 2.3f, new ConfigDescription("NVG Intensity", new AcceptableValueRange(0f, 5f))); - PNVNoiseIntensity = Config.Bind("PNV", "PNVNoiseIntensity", 0.0f, new ConfigDescription("NVG Noise Intensity", new AcceptableValueRange(0f, 5f))); - PNVNoiseScale = Config.Bind("PNV", "PNVNoiseScale", 0.0f, new ConfigDescription("NVG Noise Scale", new AcceptableValueRange(0f, 5f))); - PNVDiffuseIntensity = Config.Bind("PNV", "PNVDiffuseIntensity", 0.0f, new ConfigDescription("NVG Diffuse Intensity", new AcceptableValueRange(0f, 5f))); - PNVMaskEnabled = Config.Bind("PNV", "PNVMaskEnabled", true, new ConfigDescription("NVG Mask Overlay", null)); - PNVMaskSize = Config.Bind("PNV", "PNVMaskSize", 1.2f, new ConfigDescription("NVG Mask Overlay Size", new AcceptableValueRange(0f, 5f))); - PNVColor = Config.Bind("PNV", "PNVColor", new Color(0.00f, 0.78f, 0.00f, 0.99f), new ConfigDescription("NVG Color", null)); - // N15 Goggles - N15Enabled = Config.Bind("N15", "N15Enabled", true, new ConfigDescription("Enable N-15", null)); - N15Intensity = Config.Bind("N15", "N15Intensity", 2.3f, new ConfigDescription("NVG Intensity", new AcceptableValueRange(0f, 5f))); - N15NoiseIntensity = Config.Bind("N15", "N15NoiseIntensity", 0.0f, new ConfigDescription("NVG Noise Intensity", new AcceptableValueRange(0f, 5f))); - N15NoiseScale = Config.Bind("N15", "N15NoiseScale", 0.0f, new ConfigDescription("NVG Noise Scale", new AcceptableValueRange(0f, 5f))); - N15DiffuseIntensity = Config.Bind("N15", "N15DiffuseIntensity", 0.0f, new ConfigDescription("NVG Diffuse Intensity", new AcceptableValueRange(0f, 5f))); - N15MaskEnabled = Config.Bind("N15", "N15MaskEnabled", true, new ConfigDescription("NVG Mask Overlay", null)); - N15MaskSize = Config.Bind("N15", "N15MaskSize", 1.2f, new ConfigDescription("NVG Mask Overlay Size", new AcceptableValueRange(0f, 5f))); - N15Color = Config.Bind("N15", "N15Color", new Color(0.00f, 0.39f, 0.78f, 0.99f), new ConfigDescription("NVG Color", null)); - // PVS-14 Monocular - PVSEnabled = Config.Bind("PVS14", "PVSEnabled", true, new ConfigDescription("Enable PVS-14", null)); - PVSIntensity = Config.Bind("PVS14", "PVSIntensity", 2.3f, new ConfigDescription("NVG Intensity", new AcceptableValueRange(0f, 5f))); - PVSNoiseIntensity = Config.Bind("PVS14", "PVSNoiseIntensity", 0.0f, new ConfigDescription("NVG Noise Intensity", new AcceptableValueRange(0f, 5f))); - PVSNoiseScale = Config.Bind("PVS14", "PVSNoiseScale", 0.0f, new ConfigDescription("NVG Noise Scale", new AcceptableValueRange(0f, 5f))); - PVSDiffuseIntensity = Config.Bind("PVS14", "PVSDiffuseIntensity", 0.0f, new ConfigDescription("NVG Diffuse Intensity", new AcceptableValueRange(0f, 5f))); - PVSMaskEnabled = Config.Bind("PVS14", "PVSMaskEnabled", true, new ConfigDescription("NVG Mask Overlay", null)); - PVSMaskSize = Config.Bind("PVS14", "PVSMaskSize", 1.2f, new ConfigDescription("NVG Mask Overlay Size", new AcceptableValueRange(0f, 5f))); - PVSColor = Config.Bind("PVS14", "PVSColor", new Color(0.78f, 0.39f, 0.39f, 0.99f), new ConfigDescription("NVG Color", null)); + NVGEnabled = Config.Bind("GPNVG", "GPEnabled", true, new ConfigDescription("Enable GPNVG-18", null)); + NVGIntensity = Config.Bind("GPNVG", "GPIntensity", 2.3f, new ConfigDescription("NVG Intensity", null)); + NVGNoiseIntensity = Config.Bind("GPNVG", "GPNoiseIntensity", 0.0f, new ConfigDescription("NVG Noise Intensity", null)); + NVGNoiseScale = Config.Bind("GPNVG", "GPNoiseScale", 0.0f, new ConfigDescription("NVG Noise Scale", null)); + NVGDiffuseIntensity = Config.Bind("GPNVG", "GPDiffuseIntensity", 0.0f, new ConfigDescription("NVG Diffuse Intensity", null)); + NVGMaskEnabled = Config.Bind("GPNVG", "GPMaskEnabled", true, new ConfigDescription("NVG Mask Overlay", null)); + NVGMaskSize = Config.Bind("GPNVG", "GPMaskSize", 1.2f, new ConfigDescription("NVG Mask Overlay Size", null)); + NVGColor = Config.Bind("GPNVG", "GPColor", new Color(0.00f, 0.78f, 0.78f, 0.99f), new ConfigDescription("NVG Color", null)); // Thermal Goggles/Scopes // T-7 60Hz? T7Enabled = Config.Bind("T7", "T7Enabled", true, new ConfigDescription("Enable T-7", null)); @@ -145,38 +61,14 @@ namespace ClearVision { T7FpsMax = Config.Bind("T7", "T7FpsMax", 60, new ConfigDescription("Thermal FPS Max FPS", new AcceptableValueRange(15, 60))); T7MaskEnabled = Config.Bind("T7", "T7MaskEnabled", true, new ConfigDescription("Thermal Mask Overlay", null)); T7MaskSize = Config.Bind("T7", "T7MaskSize", 1.5f, new ConfigDescription("Thermal Mask Overlay Size", new AcceptableValueRange(0f, 5f))); - // REAP-IR 60Hz - IREnabled = Config.Bind("REAP-IR", "IREnabled", true, new ConfigDescription("Enable REAP-IR", null)); - IRNoise = Config.Bind("REAP-IR", "IRNoise", false, new ConfigDescription("Thermal Noise", null)); - IRGlitch = Config.Bind("REAP-IR", "IRGlitch", false, new ConfigDescription("Thermal Glitchiness", null)); - IRPixel = Config.Bind("REAP-IR", "IRPixel", false, new ConfigDescription("Thermal Pixelation", null)); - IRMotionBlur = Config.Bind("REAP-IR", "IRMotionBlur", false, new ConfigDescription("Thermal Motion Blur", null)); - IRFps = Config.Bind("REAP-IR", "IRFps", true, new ConfigDescription("Thermal FPS Lock Enabled", null)); - IRFpsMax = Config.Bind("REAP-IR", "IRFpsMax", 60, new ConfigDescription("Thermal FPS Max FPS", new AcceptableValueRange(15, 60))); - // FLIR RS-32 60Hz - RS32Enabled = Config.Bind("RS32", "RS32Enabled", true, new ConfigDescription("Enable REAP-RS32", null)); - RS32Noise = Config.Bind("RS32", "RS32Noise", false, new ConfigDescription("Thermal Noise", null)); - RS32Glitch = Config.Bind("RS32", "RS32Glitch", false, new ConfigDescription("Thermal Glitchiness", null)); - RS32Pixel = Config.Bind("RS32", "RS32Pixel", false, new ConfigDescription("Thermal Pixelation", null)); - RS32MotionBlur = Config.Bind("RS32", "RS32MotionBlur", false, new ConfigDescription("Thermal Motion Blur", null)); - RS32Fps = Config.Bind("RS32", "RS32Fps", true, new ConfigDescription("Thermal FPS Lock Enabled", null)); - RS32FpsMax = Config.Bind("RS32", "RS32FpsMax", 60, new ConfigDescription("Thermal FPS Max FPS", new AcceptableValueRange(15, 60))); - // Torrey Pines Logic T12 30Hz - T12Enabled = Config.Bind("T12", "T12Enabled", true, new ConfigDescription("Enable REAP-T12", null)); - T12Noise = Config.Bind("T12", "T12Noise", false, new ConfigDescription("Thermal Noise", null)); - T12Glitch = Config.Bind("T12", "T12Glitch", false, new ConfigDescription("Thermal Glitchiness", null)); - T12Pixel = Config.Bind("T12", "T12Pixel", false, new ConfigDescription("Thermal Pixelation", null)); - T12MotionBlur = Config.Bind("T12", "T12MotionBlur", false, new ConfigDescription("Thermal Motion Blur", null)); - T12Fps = Config.Bind("T12", "T12Fps", true, new ConfigDescription("Thermal FPS Lock Enabled", null)); - T12FpsMax = Config.Bind("T12", "T12FpsMax", 30, new ConfigDescription("Thermal FPS Max FPS", new AcceptableValueRange(15, 60))); - // MP-155 Ultima Camera - UltimaEnabled = Config.Bind("Ultima", "UltimaEnabled", true, new ConfigDescription("Enable REAP-Ultima", null)); - UltimaNoise = Config.Bind("Ultima", "UltimaNoise", false, new ConfigDescription("Thermal Noise", null)); - UltimaGlitch = Config.Bind("Ultima", "UltimaGlitch", false, new ConfigDescription("Thermal Glitchiness", null)); - UltimaPixel = Config.Bind("Ultima", "UltimaPixel", false, new ConfigDescription("Thermal Pixelation", null)); - UltimaMotionBlur = Config.Bind("Ultima", "UltimaMotionBlur", false, new ConfigDescription("Thermal Motion Blur", null)); - UltimaFps = Config.Bind("Ultima", "UltimaFps", true, new ConfigDescription("Thermal FPS Lock Enabled", null)); - UltimaFpsMax = Config.Bind("Ultima", "UltimaFpsMax", 60, new ConfigDescription("Thermal FPS Max FPS", new AcceptableValueRange(15, 60))); + // Thermal 60Hz + ThermalEnabled = Config.Bind("Thermal", "ThermalEnabled", true, new ConfigDescription("Enable Thermal Sights", null)); + ThermalNosie = Config.Bind("Thermal", "ThermalNosie", false, new ConfigDescription("Thermal Noise", null)); + ThermalGlitch = Config.Bind("Thermal", "ThermalGlitch", false, new ConfigDescription("Thermal Glitchiness", null)); + ThermalPixel = Config.Bind("Thermal", "ThermalPixel", false, new ConfigDescription("Thermal Pixelation", null)); + ThermalMotionBlur = Config.Bind("Thermal", "ThermalMotionBlur", false, new ConfigDescription("Thermal Motion Blur", null)); + ThermalFpsLock = Config.Bind("Thermal", "ThermalFpsLock", true, new ConfigDescription("Thermal FPS Lock Enabled", null)); + ThermalFpsMax = Config.Bind("Thermal", "ThermalFpsMax", 60, new ConfigDescription("Thermal FPS Max FPS", new AcceptableValueRange(15, 60))); } private void Awake() {