Files
wwdpublic/Content.Client/Overlays/DogVisionSystem.cs
FoxxoTrystan 40487f8a89 Remove DeltaV Options (#928)
<!--
This is a semi-strict format, you can add/remove sections as needed but
the order/format should be kept the same
Remove these comments before submitting
-->

# Description

<!--
Explain this PR in as much detail as applicable

Some example prompts to consider:
How might this affect the game? The codebase?
What might be some alternatives to this?
How/Who does this benefit/hurt [the game/codebase]?
-->

This PR Remove and the DeltaV Option Tab while moving the specie filter
to the general accessibility tab.
View Media for images.

This PR also Rebase the option and removed useless duplicated, CVars are
moved, .ftl files.
Tho cvar name is unchanged so the option will still be enable if you
enabled it before.

This PR fixes #481 and put PR #630 stale.

---

<!--
This is default collapsed, readers click to expand it and see all your
media
The PR media section can get very large at times, so this is a good way
to keep it clean
The title is written using HTML tags
The title must be within the <summary> tags or you won't see it
-->

<details><summary><h1>Media</h1></summary>
<p>

![image](https://github.com/user-attachments/assets/55fdf75d-2c02-4c25-b0df-e76cce564a33)

![image](https://github.com/user-attachments/assets/88a170fb-ba32-467c-b432-b0a8c554a489)

</p>
</details>

---

# Changelog

<!--
You can add an author after the `🆑` to change the name that appears
in the changelog (ex: `🆑 Death`)
Leaving it blank will default to your GitHub display name
This includes all available types for the changelog
-->

🆑
- remove: DeltaV Option Tab (Options moved)
# Conflicts:
#	Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
2024-10-19 13:05:04 +07:00

67 lines
2.1 KiB
C#

using Content.Shared.Traits.Assorted.Components;
using Content.Shared.CCVar;
using Robust.Client.Graphics;
using Robust.Shared.Configuration;
using Robust.Shared.Player;
namespace Content.Client.Overlays;
public sealed partial class DogVisionSystem : EntitySystem
{
[Dependency] private readonly IOverlayManager _overlayMan = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly ISharedPlayerManager _playerMan = default!;
private DogVisionOverlay _overlay = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DogVisionComponent, ComponentInit>(OnDogVisionInit);
SubscribeLocalEvent<DogVisionComponent, ComponentShutdown>(OnDogVisionShutdown);
SubscribeLocalEvent<DogVisionComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<DogVisionComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
Subs.CVar(_cfg, CCVars.NoVisionFilters, OnNoVisionFiltersChanged);
_overlay = new();
}
private void OnDogVisionInit(EntityUid uid, DogVisionComponent component, ComponentInit args)
{
if (uid != _playerMan.LocalEntity)
return;
if (!_cfg.GetCVar(CCVars.NoVisionFilters))
_overlayMan.AddOverlay(_overlay);
}
private void OnDogVisionShutdown(EntityUid uid, DogVisionComponent component, ComponentShutdown args)
{
if (uid != _playerMan.LocalEntity)
return;
_overlayMan.RemoveOverlay(_overlay);
}
private void OnPlayerAttached(EntityUid uid, DogVisionComponent component, LocalPlayerAttachedEvent args)
{
if (!_cfg.GetCVar(CCVars.NoVisionFilters))
_overlayMan.AddOverlay(_overlay);
}
private void OnPlayerDetached(EntityUid uid, DogVisionComponent component, LocalPlayerDetachedEvent args)
{
_overlayMan.RemoveOverlay(_overlay);
}
private void OnNoVisionFiltersChanged(bool enabled)
{
if (enabled)
_overlayMan.RemoveOverlay(_overlay);
else
_overlayMan.AddOverlay(_overlay);
}
}