* Beginnings of singulo shader * LOTS of changes!! * Minor changes * Singulo stuff * Aesthetic changes to singulo * Combining singulo change * ShaderAura uses IEntities now, not IPlayerSession * Fixes? * Fixes draw order for atmos * using fix * Address reviews * nuget.config whaaa * nuget haha * nuget why are you so dum * happy now * Preparing for omegachange * Merge from seventh level of hell * woork * Ignorecomponents add * mmf * RobustToolbox? * Fixes * Fixes Robust? * adds sprite * Nullables * Crit overlay stuff * Commits Robust
59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
using Content.Shared.GameObjects.Components.Mobs.State;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.Player;
|
|
using Robust.Shared.Enums;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Maths;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.Graphics.Overlays
|
|
{
|
|
public class CritOverlay : Overlay
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
|
|
|
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
|
private readonly ShaderInstance _gradientCircleShader, _glowingBorderShader;
|
|
|
|
public CritOverlay()
|
|
{
|
|
IoCManager.InjectDependencies(this);
|
|
_gradientCircleShader = _prototypeManager.Index<ShaderPrototype>("GradientCircleMask").Instance();
|
|
}
|
|
|
|
public static bool LocalPlayerHasState(IPlayerManager pm, bool critical, bool dead) {
|
|
var playerEntity = pm.LocalPlayer?.ControlledEntity;
|
|
|
|
if (playerEntity == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (playerEntity.TryGetComponent<IMobStateComponent>(out var mobState))
|
|
{
|
|
if (critical)
|
|
if (mobState.IsCritical())
|
|
return true;
|
|
if (dead)
|
|
if (mobState.IsDead())
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
protected override void Draw(DrawingHandleBase handle, OverlaySpace currentSpace)
|
|
{
|
|
if (!LocalPlayerHasState(_playerManager, true, false))
|
|
return;
|
|
|
|
var worldHandle = (DrawingHandleWorld) handle;
|
|
var viewport = _eyeManager.GetWorldViewport();
|
|
handle.UseShader(_gradientCircleShader);
|
|
worldHandle.DrawRect(viewport, Color.White);
|
|
}
|
|
}
|
|
}
|