mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
using Content.Shared.CCVar;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Shared.Configuration;
|
|
|
|
namespace Content.Client.Light.EntitySystems;
|
|
|
|
public sealed partial class PlanetLightSystem : EntitySystem
|
|
{
|
|
[Dependency] private IConfigurationManager _cfgManager = default!;
|
|
[Dependency] private IOverlayManager _overlayMan = default!;
|
|
|
|
/// <summary>
|
|
/// Enables / disables the ambient occlusion overlay.
|
|
/// </summary>
|
|
public bool AmbientOcclusion
|
|
{
|
|
get => _ambientOcclusion;
|
|
set
|
|
{
|
|
if (_ambientOcclusion == value)
|
|
return;
|
|
|
|
_ambientOcclusion = value;
|
|
|
|
if (value)
|
|
{
|
|
_overlayMan.AddOverlay(new AmbientOcclusionOverlay());
|
|
}
|
|
else
|
|
{
|
|
_overlayMan.RemoveOverlay<AmbientOcclusionOverlay>();
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool _ambientOcclusion;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<GetClearColorEvent>(OnClearColor);
|
|
|
|
_cfgManager.OnValueChanged(CCVars.AmbientOcclusion, val =>
|
|
{
|
|
AmbientOcclusion = val;
|
|
}, true);
|
|
|
|
_overlayMan.AddOverlay(new BeforeLightTargetOverlay());
|
|
_overlayMan.AddOverlay(new RoofOverlay(EntityManager));
|
|
_overlayMan.AddOverlay(new TileEmissionOverlay(EntityManager));
|
|
_overlayMan.AddOverlay(new LightBlurOverlay());
|
|
_overlayMan.AddOverlay(new SunShadowOverlay());
|
|
_overlayMan.AddOverlay(new AfterLightTargetOverlay());
|
|
}
|
|
|
|
private void OnClearColor(ref GetClearColorEvent ev)
|
|
{
|
|
ev.Color = Color.Transparent;
|
|
}
|
|
|
|
public override void Shutdown()
|
|
{
|
|
base.Shutdown();
|
|
_overlayMan.RemoveOverlay<BeforeLightTargetOverlay>();
|
|
_overlayMan.RemoveOverlay<RoofOverlay>();
|
|
_overlayMan.RemoveOverlay<TileEmissionOverlay>();
|
|
_overlayMan.RemoveOverlay<LightBlurOverlay>();
|
|
_overlayMan.RemoveOverlay<SunShadowOverlay>();
|
|
_overlayMan.RemoveOverlay<AfterLightTargetOverlay>();
|
|
}
|
|
}
|