Skip to content

Commit

Permalink
a (#655)
Browse files Browse the repository at this point in the history
  • Loading branch information
babaevlsdd authored Nov 26, 2024
1 parent 62a45ac commit ae78fa1
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<!-- Misc -->
<Label Text="{Loc 'ui-options-misc-label'}" StyleClasses="LabelKeyText"/>
<CheckBox Name="FpsCounterCheckBox" Text="{Loc 'ui-options-fps-counter'}" />
<CheckBox Name="ShowFootprintsCheckBox" Text="{Loc 'ui-options-show-footprints'}" />
</BoxContainer>
</ScrollContainer>
<ui:OptionsTabControlRow Name="Control" Access="Public" />
Expand Down
2 changes: 2 additions & 0 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();

Expand Down
28 changes: 27 additions & 1 deletion Content.Client/_Sunrise/Footprints/FootPrintsVisualizerSystem.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -12,16 +14,31 @@ public sealed class FootprintVisualizerSystem : VisualizerSystem<FootprintCompon
{
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;

private bool _showFootprints;

/// <inheritdoc/>
public override void Initialize()
{
base.Initialize();

_cfg.OnValueChanged(SunriseCCVars.ShowFootprints, OnShowFootprintsChanged, true);

SubscribeLocalEvent<FootprintComponent, ComponentInit>(OnFootprintInitialized);
SubscribeLocalEvent<FootprintComponent, ComponentShutdown>(OnFootprintShutdown);
}

private void OnShowFootprintsChanged(bool value)
{
_showFootprints = value;
var query = EntityManager.AllEntityQueryEnumerator<FootprintComponent, SpriteComponent>();
while (query.MoveNext(out var uid, out var footprint, out var sprite))
{
UpdateFootprintVisuals(uid, footprint, sprite);
}
}

/// <summary>
/// Initializes the visual appearance of a new footprint
/// </summary>
Expand Down Expand Up @@ -74,6 +91,15 @@ private void UpdateFootprintVisuals(EntityUid uid, FootprintComponent footprint,
|| !TryComp<AppearanceComponent>(uid, out var appearance))
return;

// Hide footprints if disabled in settings
if (!_showFootprints)
{
sprite.Visible = false;
return;
}

sprite.Visible = true;

if (!_appearanceSystem.TryGetData<FootprintVisualType>(
uid,
FootprintVisualParameter.VisualState,
Expand Down
8 changes: 7 additions & 1 deletion Content.Shared/_Sunrise/SunriseCCVars/SunriseCCVars.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Robust.Shared.Configuration;
using Robust.Shared.Configuration;

namespace Content.Shared._Sunrise.SunriseCCVars;

Expand Down Expand Up @@ -330,4 +330,10 @@ public static readonly CVarDef<bool>

public static readonly CVarDef<bool> MoodDecreasesSpeed =
CVarDef.Create("mood.decreases_speed", true, CVar.SERVER);

/// <summary>
/// Whether to show footprints
/// </summary>
public static readonly CVarDef<bool> ShowFootprints =
CVarDef.Create("game.show_footprints", true, CVar.CLIENTONLY | CVar.ARCHIVE);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ ui-options-lobby-art = Арт лобби
ui-options-lobby-animation = Анимация лобби
ui-options-lobby-parallax = Паралакс лобби
ui-options-damage-overlay = Оверлей урона
ui-options-show-footprints = Отображать следы

0 comments on commit ae78fa1

Please sign in to comment.