mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-30 12:07:37 +03:00
* Add option to disable vision filters * Remove DefaultVision in favor of the setting * Clean DeltaTab.xaml.cs
46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using Content.Shared.Abilities;
|
|
using Content.Shared.DeltaV.CCVars;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Shared.Configuration;
|
|
|
|
namespace Content.Client.DeltaV.Overlays;
|
|
|
|
public sealed partial class UltraVisionSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly IOverlayManager _overlayMan = default!;
|
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
|
|
private UltraVisionOverlay _overlay = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<UltraVisionComponent, ComponentInit>(OnUltraVisionInit);
|
|
SubscribeLocalEvent<UltraVisionComponent, ComponentShutdown>(OnUltraVisionShutdown);
|
|
|
|
Subs.CVar(_cfg, DCCVars.NoVisionFilters, OnNoVisionFiltersChanged);
|
|
|
|
_overlay = new();
|
|
}
|
|
|
|
private void OnUltraVisionInit(EntityUid uid, UltraVisionComponent component, ComponentInit args)
|
|
{
|
|
if (!_cfg.GetCVar(DCCVars.NoVisionFilters))
|
|
_overlayMan.AddOverlay(_overlay);
|
|
}
|
|
|
|
private void OnUltraVisionShutdown(EntityUid uid, UltraVisionComponent component, ComponentShutdown args)
|
|
{
|
|
_overlayMan.RemoveOverlay(_overlay);
|
|
}
|
|
|
|
private void OnNoVisionFiltersChanged(bool enabled)
|
|
{
|
|
if (enabled)
|
|
_overlayMan.RemoveOverlay(_overlay);
|
|
else
|
|
_overlayMan.AddOverlay(_overlay);
|
|
}
|
|
}
|