Put radiation overlay in worldspace (#5590)
This commit is contained in:
@@ -40,8 +40,7 @@ namespace Content.Client.StationEvents
|
|||||||
|
|
||||||
private TimeSpan _lastTick;
|
private TimeSpan _lastTick;
|
||||||
|
|
||||||
// TODO: When worldHandle can do DrawCircle change this.
|
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||||
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
|
|
||||||
|
|
||||||
public RadiationPulseOverlay()
|
public RadiationPulseOverlay()
|
||||||
{
|
{
|
||||||
@@ -116,29 +115,35 @@ namespace Content.Client.StationEvents
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var elapsedTime = (float) (_gameTiming.CurTime - _lastTick).TotalSeconds;
|
|
||||||
_lastTick = _gameTiming.CurTime;
|
|
||||||
|
|
||||||
var radiationPulses = _entityManager
|
var radiationPulses = _entityManager
|
||||||
.EntityQuery<RadiationPulseComponent>(true)
|
.EntityQuery<RadiationPulseComponent>(true)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var screenHandle = args.ScreenHandle;
|
if (radiationPulses.Count == 0)
|
||||||
var viewport = _eyeManager.GetWorldViewport();
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var elapsedTime = (float) (_gameTiming.CurTime - _lastTick).TotalSeconds;
|
||||||
|
_lastTick = _gameTiming.CurTime;
|
||||||
|
|
||||||
|
var worldHandle = args.WorldHandle;
|
||||||
|
var viewport = _eyeManager.GetWorldViewport();
|
||||||
foreach (var grid in _mapManager.FindGridsIntersecting(playerEntity.Transform.MapID, viewport))
|
foreach (var grid in _mapManager.FindGridsIntersecting(playerEntity.Transform.MapID, viewport))
|
||||||
{
|
{
|
||||||
|
worldHandle.SetTransform(grid.WorldMatrix);
|
||||||
foreach (var pulse in radiationPulses)
|
foreach (var pulse in radiationPulses)
|
||||||
{
|
{
|
||||||
if (!pulse.Draw || grid.Index != pulse.Owner.Transform.GridID) continue;
|
if (!pulse.Draw || grid.Index != pulse.Owner.Transform.GridID) continue;
|
||||||
|
|
||||||
// TODO: Check if viewport intersects circle
|
var pulseTransform = pulse.Owner.Transform;
|
||||||
var circlePosition = args.ViewportControl!.WorldToScreen(pulse.Owner.Transform.WorldPosition);
|
|
||||||
|
|
||||||
// change to worldhandle when implemented
|
var maxVisibleCircleArea = viewport.Enlarged(pulse.Range * 64);
|
||||||
screenHandle.DrawCircle(
|
if (!maxVisibleCircleArea.Contains(pulseTransform.WorldPosition)) continue;
|
||||||
circlePosition,
|
|
||||||
pulse.Range * 64,
|
worldHandle.DrawCircle(
|
||||||
|
pulseTransform.LocalPosition,
|
||||||
|
pulse.Range,
|
||||||
GetColor(pulse.Owner, pulse.Decay ? elapsedTime : 0, pulse.EndTime));
|
GetColor(pulse.Owner, pulse.Decay ? elapsedTime : 0, pulse.EndTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user