Reduced AI static overlay checkbox for photosensitivity (#44003)

* option to reduce ai static overlay

* wrong file path!

* requested change
This commit is contained in:
mq
2026-05-21 05:31:54 +10:00
committed by GitHub
parent 47d552f745
commit cbf1047c55
7 changed files with 35 additions and 2 deletions
@@ -7,6 +7,7 @@
<Label Text="{Loc 'ui-options-accessability-header-visuals'}"
StyleClasses="LabelKeyText"/>
<CheckBox Name="ReducedMotionCheckBox" Text="{Loc 'ui-options-reduced-motion'}" />
<CheckBox Name="DisableAiStaticCheckBox" Text="{Loc 'ui-options-disable-ai-static'}" />
<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'}" />
@@ -15,6 +15,7 @@ public sealed partial class AccessibilityTab : Control
Control.AddOptionCheckBox(CCVars.ChatEnableColorName, EnableColorNameCheckBox);
Control.AddOptionCheckBox(CCVars.AccessibilityColorblindFriendly, ColorblindFriendlyCheckBox);
Control.AddOptionCheckBox(CCVars.ReducedMotion, ReducedMotionCheckBox);
Control.AddOptionCheckBox(CCVars.DisableAiStatic, DisableAiStaticCheckBox);
Control.AddOptionPercentSlider(CCVars.ScreenShakeIntensity, ScreenShakeIntensitySlider);
Control.AddOptionPercentSlider(CCVars.ChatWindowOpacity, ChatWindowOpacitySlider);
Control.AddOptionPercentSlider(CCVars.SpeechBubbleTextOpacity, SpeechBubbleTextOpacitySlider);
@@ -1,8 +1,10 @@
using System.Numerics;
using Content.Client.Graphics;
using Content.Shared.CCVar;
using Content.Shared.Silicons.StationAi;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
@@ -14,10 +16,12 @@ namespace Content.Client.Silicons.StationAi;
public sealed partial class StationAiOverlay : Overlay
{
private static readonly ProtoId<ShaderPrototype> CameraStaticShader = "CameraStatic";
private static readonly ProtoId<ShaderPrototype> CameraStaticAccessibleShader = "CameraStaticAccessible";
private static readonly ProtoId<ShaderPrototype> StencilMaskShader = "StencilMask";
private static readonly ProtoId<ShaderPrototype> StencilDrawShader = "StencilDraw";
[Dependency] private IClyde _clyde = default!;
[Dependency] private IConfigurationManager _cfg = default!;
[Dependency] private IEntityManager _entManager = default!;
[Dependency] private IGameTiming _timing = default!;
[Dependency] private IPlayerManager _player = default!;
@@ -29,12 +33,20 @@ public sealed partial class StationAiOverlay : Overlay
private readonly OverlayResourceCache<CachedResources> _resources = new();
private ProtoId<ShaderPrototype> _activeShader = CameraStaticShader;
private float _updateRate = 1f / 30f;
private float _accumulator;
public StationAiOverlay()
{
IoCManager.InjectDependencies(this);
_cfg.OnValueChanged(CCVars.DisableAiStatic, OnAiStaticChanged, invokeImmediately: true);
}
private void OnAiStaticChanged(bool toggle)
{
_activeShader = toggle ? CameraStaticAccessibleShader : CameraStaticShader;
}
protected override void Draw(in OverlayDrawArgs args)
@@ -97,7 +109,7 @@ public sealed partial class StationAiOverlay : Overlay
() =>
{
worldHandle.SetTransform(invMatrix);
var shader = _proto.Index(CameraStaticShader).Instance();
var shader = _proto.Index(_activeShader).Instance();
worldHandle.UseShader(shader);
worldHandle.DrawRect(worldBounds, Color.White);
},
@@ -19,6 +19,13 @@ public sealed partial class CCVars
public static readonly CVarDef<bool> ReducedMotion =
CVarDef.Create("accessibility.reduced_motion", false, CVar.CLIENTONLY | CVar.ARCHIVE);
/// <summary>
/// Replaces the AI static camera effect with a plain gradient.
/// Used for photosensitivity triggers.
/// </summary>
public static readonly CVarDef<bool> DisableAiStatic =
CVarDef.Create("accessibility.disable_ai_static", false, CVar.CLIENTONLY | CVar.ARCHIVE);
public static readonly CVarDef<bool> ChatEnableColorName =
CVarDef.Create("accessibility.enable_color_name",
true,
@@ -366,6 +366,7 @@ ui-options-accessability-header-content = Content
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-screen-shake-intensity = Screen shake intensity
ui-options-chat-window-opacity = Chat window opacity
+6 -1
View File
@@ -58,6 +58,11 @@
kind: source
path: "/Textures/Shaders/camera_static.swsl"
- type: shader
id: CameraStaticAccessible
kind: source
path: "/Textures/Shaders/camera_static_accessible.swsl"
- type: shader
id: Drunk
kind: source
@@ -115,7 +120,7 @@
id: Hologram
kind: source
path: "/Textures/Shaders/hologram.swsl"
- type: shader
id: HeatBlur
kind: source
@@ -0,0 +1,6 @@
void fragment() {
highp vec2 coords = FRAGCOORD.xy;
highp vec2 value = vec2(coords * SCREEN_PIXEL_SIZE);
highp vec3 color = vec3(0.0,value.x/3.0,value.x/2.0);
COLOR = vec4(0.1 * color,1.0);
}