mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-29 03:27:41 +03:00
# Description I'm going to go put powergamers on suicide watch. This PR makes it so that specializing in psionic traits, and specializing in cybernetic traits are both mutually exclusive. You are only allowed to have a single cybernetric trait if you wish to have psionic traits. And you are only allowed to have Latent Psychic with no other traits if you wish to have Cybernetics. Also fixes a bug with Thermographic Vision not correctly being measured in seconds. You now get a 2 second pulse with Thermographic vision, as intended. # Changelog 🆑 - tweak: Psionic traits are now mutually exclusive with cybernetic traits, and vice versa. - fix: Thermographic Vision now correctly measures its pulse duration in seconds instead of nanoseconds. It provides a 2 second scan. --------- Co-authored-by: stellar-novas <stellar_novas@riseup.net> (cherry picked from commit 87eb664fa6e95b659c5753b07115d1aaea82b442)
49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
using System.Numerics;
|
|
using Content.Shared.Overlays.Switchable;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Shared.Enums;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.Overlays.Switchable;
|
|
|
|
public sealed class BaseSwitchableOverlay<TComp> : Overlay where TComp : SwitchableOverlayComponent
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
|
|
|
public override bool RequestScreenTexture => true;
|
|
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
|
|
|
private readonly ShaderInstance _shader;
|
|
|
|
public TComp? Comp = null;
|
|
|
|
public bool IsActive = true;
|
|
|
|
public BaseSwitchableOverlay()
|
|
{
|
|
IoCManager.InjectDependencies(this);
|
|
_shader = _prototype.Index<ShaderPrototype>("NightVision").InstanceUnique();
|
|
}
|
|
|
|
protected override void Draw(in OverlayDrawArgs args)
|
|
{
|
|
if (ScreenTexture is null || Comp is null || !IsActive)
|
|
return;
|
|
|
|
_shader.SetParameter("SCREEN_TEXTURE", ScreenTexture);
|
|
_shader.SetParameter("tint", Comp.Tint);
|
|
_shader.SetParameter("luminance_threshold", Comp.Strength);
|
|
_shader.SetParameter("noise_amount", Comp.Noise);
|
|
|
|
var worldHandle = args.WorldHandle;
|
|
|
|
var accumulator = Math.Clamp((float) Comp.PulseAccumulator.TotalSeconds, 0f, Comp.PulseTime);
|
|
var alpha = Comp.PulseTime <= 0 ? 1f : float.Lerp(1f, 0f, accumulator / Comp.PulseTime);
|
|
|
|
worldHandle.SetTransform(Matrix3x2.Identity);
|
|
worldHandle.UseShader(_shader);
|
|
worldHandle.DrawRect(args.WorldBounds, Comp.Color.WithAlpha(alpha));
|
|
worldHandle.UseShader(null);
|
|
}
|
|
}
|