diff --git a/Content.Client/Camera/CameraRecoilSystem.cs b/Content.Client/Camera/CameraRecoilSystem.cs index 65a3fc71c7..bb419b465d 100644 --- a/Content.Client/Camera/CameraRecoilSystem.cs +++ b/Content.Client/Camera/CameraRecoilSystem.cs @@ -1,14 +1,34 @@ using System.Numerics; using Content.Shared.Camera; +using Content.Shared.CCVar; +using Robust.Shared.Configuration; namespace Content.Client.Camera; public sealed class CameraRecoilSystem : SharedCameraRecoilSystem { + [Dependency] private readonly IConfigurationManager _configManager = default!; + + protected float Intensity; + public override void Initialize() { base.Initialize(); SubscribeNetworkEvent(OnCameraKick); + + _configManager.OnValueChanged(CCVars.ScreenShakeIntensity, OnCvarChanged, true); + } + + public override void Shutdown() + { + base.Shutdown(); + + _configManager.UnsubValueChanged(CCVars.ScreenShakeIntensity, OnCvarChanged); + } + + private void OnCvarChanged(float value) + { + Intensity = value; } private void OnCameraKick(CameraKickEvent ev) @@ -18,9 +38,14 @@ public sealed class CameraRecoilSystem : SharedCameraRecoilSystem public override void KickCamera(EntityUid uid, Vector2 recoil, CameraRecoilComponent? component = null) { + if (Intensity == 0) + return; + if (!Resolve(uid, ref component, false)) return; + recoil *= Intensity; + // Use really bad math to "dampen" kicks when we're already kicked. var existing = component.CurrentKick.Length(); var dampen = existing / KickMagnitudeMax; diff --git a/Content.Client/Options/UI/Tabs/MiscTab.xaml b/Content.Client/Options/UI/Tabs/MiscTab.xaml index e37333b0e4..db176db456 100644 --- a/Content.Client/Options/UI/Tabs/MiscTab.xaml +++ b/Content.Client/Options/UI/Tabs/MiscTab.xaml @@ -22,6 +22,15 @@ FontColorOverride="{xNamespace:Static s:StyleNano.NanoGold}" StyleClasses="LabelKeyText"/> + +