Singularity Shaders and a lot of Shader Stuff (#2517)
* 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
This commit is contained in:
@@ -6,6 +6,8 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Enums;
|
||||
using System;
|
||||
|
||||
namespace Content.Client.Atmos
|
||||
{
|
||||
@@ -19,7 +21,7 @@ namespace Content.Client.Atmos
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||
|
||||
public AtmosDebugOverlay() : base(nameof(AtmosDebugOverlay))
|
||||
public AtmosDebugOverlay()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -15,9 +16,9 @@ namespace Content.Client.Atmos
|
||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||
[Dependency] private readonly IClyde _clyde = default!;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
||||
|
||||
public GasTileOverlay() : base(nameof(GasTileOverlay))
|
||||
public GasTileOverlay()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using Content.Client.Administration;
|
||||
using Content.Client.Changelog;
|
||||
using Content.Client.Eui;
|
||||
@@ -152,12 +152,15 @@ namespace Content.Client
|
||||
IoCManager.Resolve<IGameHud>().Initialize();
|
||||
IoCManager.Resolve<IClientNotifyManager>().Initialize();
|
||||
IoCManager.Resolve<IClientGameTicker>().Initialize();
|
||||
|
||||
var overlayMgr = IoCManager.Resolve<IOverlayManager>();
|
||||
overlayMgr.AddOverlay(new ParallaxOverlay());
|
||||
overlayMgr.AddOverlay(new GradientCircleMaskOverlay());
|
||||
overlayMgr.AddOverlay(new SingularityOverlay());
|
||||
overlayMgr.AddOverlay(new CritOverlay()); //Hopefully we can cut down on this list... don't see why a death overlay needs to be instantiated here.
|
||||
overlayMgr.AddOverlay(new CircleMaskOverlay());
|
||||
overlayMgr.AddOverlay(new FlashOverlay());
|
||||
overlayMgr.AddOverlay(new RadiationPulseOverlay());
|
||||
|
||||
IoCManager.Resolve<IChatManager>().Initialize();
|
||||
IoCManager.Resolve<ISandboxManager>().Initialize();
|
||||
IoCManager.Resolve<IClientPreferencesManager>().Initialize();
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using Content.Shared.GameObjects.Components.Singularity;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Singularity
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IClientSingularityInstance))]
|
||||
class ClientSingularityComponent : SharedSingularityComponent, IClientSingularityInstance
|
||||
{
|
||||
public int Level
|
||||
{
|
||||
get
|
||||
{
|
||||
return _level;
|
||||
}
|
||||
set
|
||||
{
|
||||
_level = value;
|
||||
}
|
||||
}
|
||||
private int _level;
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
{
|
||||
if (curState is not SingularityComponentState state)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_level = state.Level;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Singularity
|
||||
{
|
||||
interface IClientSingularityInstance
|
||||
{
|
||||
public int Level { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Singularity
|
||||
{
|
||||
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IClientSingularityInstance))]
|
||||
public class ToySingularityComponent : Component, IClientSingularityInstance
|
||||
{
|
||||
public override string Name => "ToySingularity";
|
||||
public int Level {
|
||||
get {
|
||||
return 1;
|
||||
}
|
||||
set {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Client.UserInterface.Suspicion;
|
||||
@@ -68,7 +68,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
|
||||
|
||||
private void AddTraitorOverlay()
|
||||
{
|
||||
if (_overlayManager.HasOverlay(nameof(TraitorOverlay)))
|
||||
if (_overlayManager.HasOverlay<TraitorOverlay>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
|
||||
return;
|
||||
}
|
||||
|
||||
_overlayManager.RemoveOverlay(nameof(TraitorOverlay));
|
||||
_overlayManager.RemoveOverlay<TraitorOverlay>();
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -25,7 +26,6 @@ namespace Content.Client.GameObjects.Components.Suspicion
|
||||
IEntityManager entityManager,
|
||||
IResourceCache resourceCache,
|
||||
IEyeManager eyeManager)
|
||||
: base(nameof(TraitorOverlay))
|
||||
{
|
||||
_playerManager = IoCManager.Resolve<IPlayerManager>();
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Client.Graphics.Overlays;
|
||||
using Content.Shared.GameObjects.Components.Weapons;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -15,7 +17,7 @@ namespace Content.Client.GameObjects.Components.Weapons
|
||||
private TimeSpan _startTime;
|
||||
private double _duration;
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
if (curState == null)
|
||||
{
|
||||
@@ -55,7 +57,7 @@ namespace Content.Client.GameObjects.Components.Weapons
|
||||
_duration = newState.Duration;
|
||||
|
||||
var overlayManager = IoCManager.Resolve<IOverlayManager>();
|
||||
var overlay = overlayManager.GetOverlay<FlashOverlay>(nameof(FlashOverlay));
|
||||
var overlay = overlayManager.GetOverlay<FlashOverlay>();
|
||||
overlay.ReceiveFlash(_duration);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using Content.Shared.AI;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
@@ -106,7 +107,7 @@ namespace Content.Client.GameObjects.EntitySystems.AI
|
||||
|
||||
_overlay.Modes = 0;
|
||||
var overlayManager = IoCManager.Resolve<IOverlayManager>();
|
||||
overlayManager.RemoveOverlay(_overlay.ID);
|
||||
overlayManager.RemoveOverlay(_overlay);
|
||||
_overlay = null;
|
||||
}
|
||||
|
||||
@@ -205,7 +206,7 @@ namespace Content.Client.GameObjects.EntitySystems.AI
|
||||
public readonly List<SharedAiDebug.AStarRouteMessage> AStarRoutes = new();
|
||||
public readonly List<SharedAiDebug.JpsRouteMessage> JpsRoutes = new();
|
||||
|
||||
public DebugPathfindingOverlay() : base(nameof(DebugPathfindingOverlay))
|
||||
public DebugPathfindingOverlay()
|
||||
{
|
||||
_shader = IoCManager.Resolve<IPrototypeManager>().Index<ShaderPrototype>("unshaded").Instance();
|
||||
_eyeManager = IoCManager.Resolve<IEyeManager>();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.Atmos;
|
||||
using Content.Shared.GameObjects.EntitySystems.Atmos;
|
||||
@@ -43,7 +44,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
_mapManager.OnGridRemoved += OnGridRemoved;
|
||||
|
||||
var overlayManager = IoCManager.Resolve<IOverlayManager>();
|
||||
if(!overlayManager.HasOverlay(nameof(AtmosDebugOverlay)))
|
||||
if(!overlayManager.HasOverlay<AtmosDebugOverlay>())
|
||||
overlayManager.AddOverlay(new AtmosDebugOverlay());
|
||||
}
|
||||
|
||||
@@ -62,8 +63,8 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
base.Shutdown();
|
||||
_mapManager.OnGridRemoved -= OnGridRemoved;
|
||||
var overlayManager = IoCManager.Resolve<IOverlayManager>();
|
||||
if(!overlayManager.HasOverlay(nameof(GasTileOverlay)))
|
||||
overlayManager.RemoveOverlay(nameof(GasTileOverlay));
|
||||
if(!overlayManager.HasOverlay<GasTileOverlay>())
|
||||
overlayManager.RemoveOverlay<GasTileOverlay>();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.Atmos;
|
||||
@@ -88,7 +88,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
}
|
||||
|
||||
var overlayManager = IoCManager.Resolve<IOverlayManager>();
|
||||
if(!overlayManager.HasOverlay(nameof(GasTileOverlay)))
|
||||
if(!overlayManager.HasOverlay<GasTileOverlay>())
|
||||
overlayManager.AddOverlay(new GasTileOverlay());
|
||||
}
|
||||
|
||||
@@ -126,8 +126,8 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
base.Shutdown();
|
||||
_mapManager.OnGridRemoved -= OnGridRemoved;
|
||||
var overlayManager = IoCManager.Resolve<IOverlayManager>();
|
||||
if(!overlayManager.HasOverlay(nameof(GasTileOverlay)))
|
||||
overlayManager.RemoveOverlay(nameof(GasTileOverlay));
|
||||
if(!overlayManager.HasOverlay<GasTileOverlay>())
|
||||
overlayManager.RemoveOverlay<GasTileOverlay>();
|
||||
}
|
||||
|
||||
private void OnGridRemoved(GridId gridId)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -15,7 +16,7 @@ namespace Content.Client.Graphics.Overlays
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||
private readonly ShaderInstance _shader;
|
||||
|
||||
public CircleMaskOverlay() : base(nameof(CircleMaskOverlay))
|
||||
public CircleMaskOverlay()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_shader = _prototypeManager.Index<ShaderPrototype>("CircleMask").Instance();
|
||||
@@ -23,7 +24,7 @@ namespace Content.Client.Graphics.Overlays
|
||||
|
||||
protected override void Draw(DrawingHandleBase handle, OverlaySpace currentSpace)
|
||||
{
|
||||
if (!GradientCircleMaskOverlay.LocalPlayerHasState(_playerManager, false, true))
|
||||
if (!CritOverlay.LocalPlayerHasState(_playerManager, false, true))
|
||||
return;
|
||||
handle.UseShader(_shader);
|
||||
var worldHandle = (DrawingHandleWorld)handle;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#nullable enable
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using System;
|
||||
|
||||
namespace Content.Client.Graphics.Overlays
|
||||
{
|
||||
public class ColoredScreenBorderOverlay : Overlay
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||
private readonly ShaderInstance _shader;
|
||||
|
||||
public ColoredScreenBorderOverlay()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_shader = _prototypeManager.Index<ShaderPrototype>("ColoredScreenBorder").Instance();
|
||||
}
|
||||
|
||||
protected override void Draw(DrawingHandleBase handle, OverlaySpace currentSpace)
|
||||
{
|
||||
handle.UseShader(_shader);
|
||||
var worldHandle = (DrawingHandleWorld)handle;
|
||||
var viewport = _eyeManager.GetWorldViewport();
|
||||
worldHandle.DrawRect(viewport, Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,26 @@
|
||||
using Content.Shared.GameObjects.Components.Mobs.State;
|
||||
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 GradientCircleMaskOverlay : Overlay
|
||||
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 _shader;
|
||||
private readonly ShaderInstance _gradientCircleShader, _glowingBorderShader;
|
||||
|
||||
public GradientCircleMaskOverlay() : base(nameof(GradientCircleMaskOverlay))
|
||||
public CritOverlay()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_shader = _prototypeManager.Index<ShaderPrototype>("GradientCircleMask").Instance();
|
||||
_gradientCircleShader = _prototypeManager.Index<ShaderPrototype>("GradientCircleMask").Instance();
|
||||
}
|
||||
|
||||
public static bool LocalPlayerHasState(IPlayerManager pm, bool critical, bool dead) {
|
||||
@@ -48,9 +49,9 @@ namespace Content.Client.Graphics.Overlays
|
||||
if (!LocalPlayerHasState(_playerManager, true, false))
|
||||
return;
|
||||
|
||||
handle.UseShader(_shader);
|
||||
var worldHandle = (DrawingHandleWorld)handle;
|
||||
var worldHandle = (DrawingHandleWorld) handle;
|
||||
var viewport = _eyeManager.GetWorldViewport();
|
||||
handle.UseShader(_gradientCircleShader);
|
||||
worldHandle.DrawRect(viewport, Color.White);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -20,7 +21,7 @@ namespace Content.Client.Graphics.Overlays
|
||||
private double _lastsFor = 1;
|
||||
private Texture _screenshotTexture;
|
||||
|
||||
public FlashOverlay() : base(nameof(FlashOverlay))
|
||||
public FlashOverlay()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_shader = _prototypeManager.Index<ShaderPrototype>("FlashedEffect").Instance().Duplicate();
|
||||
@@ -54,10 +55,9 @@ namespace Content.Client.Graphics.Overlays
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
protected override void DisposeBehavior()
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
base.Dispose();
|
||||
_screenshotTexture = null;
|
||||
}
|
||||
}
|
||||
|
||||
174
Content.Client/Graphics/Overlays/SingularityOverlay.cs
Normal file
174
Content.Client/Graphics/Overlays/SingularityOverlay.cs
Normal file
@@ -0,0 +1,174 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Client.Graphics;
|
||||
using System.Linq;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Content.Client.GameObjects.Components.Singularity;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Client.Graphics.Overlays
|
||||
{
|
||||
public class SingularityOverlay : Overlay
|
||||
{
|
||||
[Dependency] private readonly IComponentManager _componentManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||
[Dependency] private readonly IClyde _displayManager = default!;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||
public override bool RequestScreenTexture => true;
|
||||
|
||||
private readonly ShaderInstance _shader;
|
||||
|
||||
Dictionary<EntityUid, SingularityShaderInstance> _singularities = new Dictionary<EntityUid, SingularityShaderInstance>();
|
||||
|
||||
public SingularityOverlay()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_shader = _prototypeManager.Index<ShaderPrototype>("Singularity").Instance().Duplicate();
|
||||
}
|
||||
|
||||
public override bool OverwriteTargetFrameBuffer()
|
||||
{
|
||||
return _singularities.Count() > 0;
|
||||
}
|
||||
|
||||
protected override void Draw(DrawingHandleBase handle, OverlaySpace currentSpace)
|
||||
{
|
||||
SingularityQuery();
|
||||
|
||||
foreach (SingularityShaderInstance instance in _singularities.Values)
|
||||
{
|
||||
var tempCoords = _eyeManager.WorldToScreen(instance.CurrentMapCoords);
|
||||
tempCoords.Y = _displayManager.ScreenSize.Y - tempCoords.Y;
|
||||
_shader?.SetParameter("positionInput", tempCoords);
|
||||
if (ScreenTexture != null)
|
||||
_shader?.SetParameter("SCREEN_TEXTURE", ScreenTexture);
|
||||
_shader?.SetParameter("intensity", LevelToIntensity(instance.Level));
|
||||
_shader?.SetParameter("falloff", LevelToFalloff(instance.Level));
|
||||
|
||||
handle.UseShader(_shader);
|
||||
var worldHandle = (DrawingHandleWorld) handle;
|
||||
var viewport = _eyeManager.GetWorldViewport();
|
||||
worldHandle.DrawRect(viewport, Color.White);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Queries all singulos on the map and either adds or removes them from the list of singulos to render depending on their location and existence.
|
||||
private float _maxDist = 15.0f;
|
||||
private void SingularityQuery()
|
||||
{
|
||||
var currentEyeLoc = _eyeManager.CurrentEye.Position;
|
||||
|
||||
var singuloComponents = _componentManager.EntityQuery<IClientSingularityInstance>();
|
||||
foreach (var singuloInterface in singuloComponents)
|
||||
{
|
||||
var singuloComponent = (Component)singuloInterface;
|
||||
var singuloEntity = singuloComponent.Owner;
|
||||
if (!_singularities.Keys.Contains(singuloEntity.Uid) && singuloEntity.Transform.Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, singuloEntity.Transform.ParentUid, currentEyeLoc), _maxDist))
|
||||
{
|
||||
_singularities.Add(singuloEntity.Uid, new SingularityShaderInstance(singuloEntity.Transform.MapPosition.Position, singuloInterface.Level));
|
||||
}
|
||||
}
|
||||
|
||||
var activeShaderUids = _singularities.Keys;
|
||||
foreach (var activeSinguloUid in activeShaderUids)
|
||||
{
|
||||
if (_entityManager.TryGetEntity(activeSinguloUid, out IEntity? singuloEntity))
|
||||
{
|
||||
if (!singuloEntity.Transform.Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, singuloEntity.Transform.ParentUid, currentEyeLoc), _maxDist))
|
||||
{
|
||||
_singularities.Remove(activeSinguloUid);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!singuloEntity.TryGetComponent<IClientSingularityInstance>(out var singuloInterface))
|
||||
{
|
||||
_singularities.Remove(activeSinguloUid);
|
||||
}
|
||||
else
|
||||
{
|
||||
var shaderInstance = _singularities[activeSinguloUid];
|
||||
shaderInstance.CurrentMapCoords = singuloEntity.Transform.MapPosition.Position;
|
||||
shaderInstance.Level = singuloInterface.Level;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_singularities.Remove(activeSinguloUid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//I am lazy
|
||||
private float LevelToIntensity(int level)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case 0:
|
||||
return 0.0f;
|
||||
case 1:
|
||||
return 2.7f;
|
||||
case 2:
|
||||
return 14.4f;
|
||||
case 3:
|
||||
return 47.2f;
|
||||
case 4:
|
||||
return 180.0f;
|
||||
case 5:
|
||||
return 600.0f;
|
||||
case 6:
|
||||
return 800.0f;
|
||||
|
||||
}
|
||||
return -1.0f;
|
||||
}
|
||||
private float LevelToFalloff(int level)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case 0:
|
||||
return 9999f;
|
||||
case 1:
|
||||
return 6.4f;
|
||||
case 2:
|
||||
return 7.0f;
|
||||
case 3:
|
||||
return 8.0f;
|
||||
case 4:
|
||||
return 10.0f;
|
||||
case 5:
|
||||
return 12.0f;
|
||||
case 6:
|
||||
return 12.0f;
|
||||
}
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
private sealed class SingularityShaderInstance
|
||||
{
|
||||
public Vector2 CurrentMapCoords;
|
||||
public int Level;
|
||||
public SingularityShaderInstance(Vector2 mapCoords, int level)
|
||||
{
|
||||
CurrentMapCoords = mapCoords;
|
||||
Level = level;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,6 @@ namespace Content.Client
|
||||
"ContainmentFieldGenerator",
|
||||
"ContainmentField",
|
||||
"Emitter",
|
||||
"Singularity",
|
||||
"SingularityGenerator",
|
||||
"EmitterBoltComponent",
|
||||
"ParticleProjectile",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Client.Interfaces.Parallax;
|
||||
using Content.Client.Interfaces.Parallax;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -13,7 +14,6 @@ namespace Content.Client.Parallax
|
||||
[Dependency] private readonly IClyde _displayManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
public override bool AlwaysDirty => true;
|
||||
private const float Slowness = 0.5f;
|
||||
|
||||
private Texture _parallaxTexture;
|
||||
@@ -21,7 +21,7 @@ namespace Content.Client.Parallax
|
||||
public override OverlaySpace Space => OverlaySpace.ScreenSpaceBelowWorld;
|
||||
private readonly ShaderInstance _shader;
|
||||
|
||||
public ParallaxOverlay() : base(nameof(ParallaxOverlay))
|
||||
public ParallaxOverlay()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_shader = _prototypeManager.Index<ShaderPrototype>("unshaded").Instance();
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Client.GameObjects.Components.StationEvents;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
@@ -44,7 +45,7 @@ namespace Content.Client.StationEvents
|
||||
// TODO: When worldHandle can do DrawCircle change this.
|
||||
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
|
||||
|
||||
public RadiationPulseOverlay() : base(nameof(RadiationPulseOverlay))
|
||||
public RadiationPulseOverlay()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_lastTick = _gameTiming.CurTime;
|
||||
|
||||
Reference in New Issue
Block a user