From ae78fa1048e6d2c7ad283b5edc5ec9e2b0247644 Mon Sep 17 00:00:00 2001
From: Babaev <129369024+babaevlsdd@users.noreply.github.com>
Date: Tue, 26 Nov 2024 20:36:16 +0600
Subject: [PATCH] a (#655)
---
.../Options/UI/Tabs/GraphicsTab.xaml | 1 +
.../Options/UI/Tabs/GraphicsTab.xaml.cs | 2 ++
.../Footprints/FootPrintsVisualizerSystem.cs | 28 ++++++++++++++++++-
.../_Sunrise/SunriseCCVars/SunriseCCVars.cs | 8 +++++-
.../_sunrise/escape-menu/ui/options-menu.ftl | 1 +
5 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml
index f1b9743cad3..665da2cffee 100644
--- a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml
+++ b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml
@@ -31,6 +31,7 @@
+
diff --git a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
index f53a2edd957..3770429f00d 100644
--- a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
+++ b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
@@ -1,4 +1,5 @@
using Content.Shared.CCVar;
+using Content.Shared._Sunrise.SunriseCCVars;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
@@ -60,6 +61,7 @@ public GraphicsTab()
Control.AddOptionCheckBox(CCVars.ViewportScaleRender, ViewportLowResCheckBox, invert: true);
Control.AddOptionCheckBox(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox);
Control.AddOptionCheckBox(CCVars.HudFpsCounterVisible, FpsCounterCheckBox);
+ Control.AddOptionCheckBox(SunriseCCVars.ShowFootprints, ShowFootprintsCheckBox);
Control.Initialize();
diff --git a/Content.Client/_Sunrise/Footprints/FootPrintsVisualizerSystem.cs b/Content.Client/_Sunrise/Footprints/FootPrintsVisualizerSystem.cs
index d17617e6ba1..78601e06c77 100644
--- a/Content.Client/_Sunrise/Footprints/FootPrintsVisualizerSystem.cs
+++ b/Content.Client/_Sunrise/Footprints/FootPrintsVisualizerSystem.cs
@@ -1,6 +1,8 @@
-using Content.Shared._Sunrise.Footprints;
+using Content.Shared._Sunrise.Footprints;
+using Content.Shared._Sunrise.SunriseCCVars;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
+using Robust.Shared.Configuration;
using Robust.Shared.Random;
namespace Content.Client._Sunrise.Footprints;
@@ -12,16 +14,31 @@ public sealed class FootprintVisualizerSystem : VisualizerSystem
public override void Initialize()
{
base.Initialize();
+ _cfg.OnValueChanged(SunriseCCVars.ShowFootprints, OnShowFootprintsChanged, true);
+
SubscribeLocalEvent(OnFootprintInitialized);
SubscribeLocalEvent(OnFootprintShutdown);
}
+ private void OnShowFootprintsChanged(bool value)
+ {
+ _showFootprints = value;
+ var query = EntityManager.AllEntityQueryEnumerator();
+ while (query.MoveNext(out var uid, out var footprint, out var sprite))
+ {
+ UpdateFootprintVisuals(uid, footprint, sprite);
+ }
+ }
+
///
/// Initializes the visual appearance of a new footprint
///
@@ -74,6 +91,15 @@ private void UpdateFootprintVisuals(EntityUid uid, FootprintComponent footprint,
|| !TryComp(uid, out var appearance))
return;
+ // Hide footprints if disabled in settings
+ if (!_showFootprints)
+ {
+ sprite.Visible = false;
+ return;
+ }
+
+ sprite.Visible = true;
+
if (!_appearanceSystem.TryGetData(
uid,
FootprintVisualParameter.VisualState,
diff --git a/Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs b/Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs
index a640b11edfd..12b5e935ead 100644
--- a/Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs
+++ b/Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs
@@ -1,4 +1,4 @@
-using Robust.Shared.Configuration;
+using Robust.Shared.Configuration;
namespace Content.Shared._Sunrise.SunriseCCVars;
@@ -330,4 +330,10 @@ public static readonly CVarDef
public static readonly CVarDef MoodDecreasesSpeed =
CVarDef.Create("mood.decreases_speed", true, CVar.SERVER);
+
+ ///
+ /// Whether to show footprints
+ ///
+ public static readonly CVarDef ShowFootprints =
+ CVarDef.Create("game.show_footprints", true, CVar.CLIENTONLY | CVar.ARCHIVE);
}
diff --git a/Resources/Locale/ru-RU/_strings/_sunrise/escape-menu/ui/options-menu.ftl b/Resources/Locale/ru-RU/_strings/_sunrise/escape-menu/ui/options-menu.ftl
index ae23058f45d..a612fa06d1f 100644
--- a/Resources/Locale/ru-RU/_strings/_sunrise/escape-menu/ui/options-menu.ftl
+++ b/Resources/Locale/ru-RU/_strings/_sunrise/escape-menu/ui/options-menu.ftl
@@ -4,3 +4,4 @@ ui-options-lobby-art = Арт лобби
ui-options-lobby-animation = Анимация лобби
ui-options-lobby-parallax = Паралакс лобби
ui-options-damage-overlay = Оверлей урона
+ui-options-show-footprints = Отображать следы
\ No newline at end of file