mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
Add accessibility option to remove noise from the night vision overlay (#44526)
* disable noise button * make noise static instead of disabling it * Revert "make noise static instead of disabling it" This reverts commit 3392776ad85fe6fa7c704785e2e685d9d32b0e7f. * rename to _configManager * Minor formatting --------- Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
This commit is contained in:
parent
d1a5afae5a
commit
710a6bf61a
5 changed files with 22 additions and 2 deletions
|
|
@ -8,6 +8,7 @@
|
|||
StyleClasses="LabelKeyText"/>
|
||||
<CheckBox Name="ReducedMotionCheckBox" Text="{Loc 'ui-options-reduced-motion'}" />
|
||||
<CheckBox Name="DisableAiStaticCheckBox" Text="{Loc 'ui-options-disable-ai-static'}" />
|
||||
<CheckBox Name="DisableNightVisionNoiseCheckBox" Text="{Loc 'ui-options-disable-nv-noise'}" />
|
||||
<CheckBox Name="EnableColorNameCheckBox" Text="{Loc 'ui-options-enable-color-name'}" />
|
||||
<CheckBox Name="ColorblindFriendlyCheckBox" Text="{Loc 'ui-options-colorblind-friendly'}" />
|
||||
<ui:OptionSlider Name="ScreenShakeIntensitySlider" Title="{Loc 'ui-options-screen-shake-intensity'}" />
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ public sealed partial class AccessibilityTab : Control
|
|||
Control.AddOptionCheckBox(CCVars.AccessibilityColorblindFriendly, ColorblindFriendlyCheckBox);
|
||||
Control.AddOptionCheckBox(CCVars.ReducedMotion, ReducedMotionCheckBox);
|
||||
Control.AddOptionCheckBox(CCVars.DisableAiStatic, DisableAiStaticCheckBox);
|
||||
Control.AddOptionCheckBox(CCVars.DisableNightVisionNoise, DisableNightVisionNoiseCheckBox);
|
||||
Control.AddOptionPercentSlider(CCVars.ScreenShakeIntensity, ScreenShakeIntensitySlider);
|
||||
Control.AddOptionPercentSlider(CCVars.ChatWindowOpacity, ChatWindowOpacitySlider);
|
||||
Control.AddOptionPercentSlider(CCVars.SpeechBubbleTextOpacity, SpeechBubbleTextOpacitySlider);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using Content.Shared.CCVar;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
|
|
@ -10,6 +12,7 @@ namespace Content.Client.Overlays;
|
|||
public sealed partial class NightVisionOverlay : Overlay
|
||||
{
|
||||
[Dependency] private IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private IConfigurationManager _configManager = default!;
|
||||
|
||||
private static readonly ProtoId<ShaderPrototype> Shader = "NightVision";
|
||||
private readonly ShaderInstance _nightVisionShader;
|
||||
|
|
@ -19,6 +22,8 @@ public sealed partial class NightVisionOverlay : Overlay
|
|||
public float NoiseAmount { get; private set; }
|
||||
public float NoiseMultiplier { get; private set; }
|
||||
|
||||
public bool DisableNoise = false;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.BeforeLighting | OverlaySpace.WorldSpace;
|
||||
public override bool RequestScreenTexture => true;
|
||||
|
||||
|
|
@ -26,6 +31,12 @@ public sealed partial class NightVisionOverlay : Overlay
|
|||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_nightVisionShader = _prototypeManager.Index(Shader).InstanceUnique();
|
||||
_configManager.OnValueChanged(CCVars.DisableNightVisionNoise, OnNightVisionNoiseChanged, invokeImmediately: true);
|
||||
}
|
||||
|
||||
private void OnNightVisionNoiseChanged(bool toggle)
|
||||
{
|
||||
DisableNoise = toggle;
|
||||
}
|
||||
|
||||
public void SetParameters(Color overlayColor, Color lightingColor, float noiseAmount, float noiseMultiplier)
|
||||
|
|
@ -47,8 +58,8 @@ public sealed partial class NightVisionOverlay : Overlay
|
|||
if (isSpace)
|
||||
{
|
||||
_nightVisionShader.SetParameter("SCREEN_TEXTURE", ScreenTexture);
|
||||
_nightVisionShader.SetParameter("noise_amount", NoiseAmount);
|
||||
_nightVisionShader.SetParameter("noise_multiplier", NoiseMultiplier);
|
||||
_nightVisionShader.SetParameter("noise_amount", !DisableNoise ? NoiseAmount : 0);
|
||||
_nightVisionShader.SetParameter("noise_multiplier", !DisableNoise ? NoiseMultiplier : 0);
|
||||
handle.UseShader(_nightVisionShader);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,12 @@ public sealed partial class CCVars
|
|||
public static readonly CVarDef<bool> DisableAiStatic =
|
||||
CVarDef.Create("accessibility.disable_ai_static", false, CVar.CLIENTONLY | CVar.ARCHIVE);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the noise from the night vision overlay.
|
||||
/// </summary>
|
||||
public static readonly CVarDef<bool> DisableNightVisionNoise =
|
||||
CVarDef.Create("accessibility.disable_nv_noise", false, CVar.CLIENTONLY | CVar.ARCHIVE);
|
||||
|
||||
public static readonly CVarDef<bool> ChatEnableColorName =
|
||||
CVarDef.Create("accessibility.enable_color_name",
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -368,6 +368,7 @@ ui-options-enable-color-name = Add colors to character names
|
|||
ui-options-colorblind-friendly = Colorblind friendly mode
|
||||
ui-options-reduced-motion = Reduce motion of visual effects
|
||||
ui-options-disable-ai-static = Disable the static effect on the AI camera overlay
|
||||
ui-options-disable-nv-noise = Disable the noise effect on the night vision overlay
|
||||
ui-options-screen-shake-intensity = Screen shake intensity
|
||||
|
||||
ui-options-chat-window-opacity = Chat window opacity
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue