Added winddown to space drugs effect (#25652)
added winddown to drug effect
This commit is contained in:
@@ -38,6 +38,7 @@ public sealed class DrugOverlaySystem : EntitySystem
|
|||||||
private void OnPlayerDetached(EntityUid uid, SeeingRainbowsComponent component, LocalPlayerDetachedEvent args)
|
private void OnPlayerDetached(EntityUid uid, SeeingRainbowsComponent component, LocalPlayerDetachedEvent args)
|
||||||
{
|
{
|
||||||
_overlay.Intoxication = 0;
|
_overlay.Intoxication = 0;
|
||||||
|
_overlay.TimeTicker = 0;
|
||||||
_overlayMan.RemoveOverlay(_overlay);
|
_overlayMan.RemoveOverlay(_overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +53,7 @@ public sealed class DrugOverlaySystem : EntitySystem
|
|||||||
if (_player.LocalEntity == uid)
|
if (_player.LocalEntity == uid)
|
||||||
{
|
{
|
||||||
_overlay.Intoxication = 0;
|
_overlay.Intoxication = 0;
|
||||||
|
_overlay.TimeTicker = 0;
|
||||||
_overlayMan.RemoveOverlay(_overlay);
|
_overlayMan.RemoveOverlay(_overlay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public sealed class RainbowOverlay : Overlay
|
|||||||
private readonly ShaderInstance _rainbowShader;
|
private readonly ShaderInstance _rainbowShader;
|
||||||
|
|
||||||
public float Intoxication = 0.0f;
|
public float Intoxication = 0.0f;
|
||||||
|
public float TimeTicker = 0.0f;
|
||||||
|
|
||||||
private const float VisualThreshold = 10.0f;
|
private const float VisualThreshold = 10.0f;
|
||||||
private const float PowerDivisor = 250.0f;
|
private const float PowerDivisor = 250.0f;
|
||||||
@@ -48,8 +49,18 @@ public sealed class RainbowOverlay : Overlay
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var timeLeft = (float) (time.Value.Item2 - time.Value.Item1).TotalSeconds;
|
var timeLeft = (float) (time.Value.Item2 - time.Value.Item1).TotalSeconds;
|
||||||
|
|
||||||
|
TimeTicker += args.DeltaSeconds;
|
||||||
|
|
||||||
|
if (timeLeft - TimeTicker > timeLeft / 16f)
|
||||||
|
{
|
||||||
Intoxication += (timeLeft - Intoxication) * args.DeltaSeconds / 16f;
|
Intoxication += (timeLeft - Intoxication) * args.DeltaSeconds / 16f;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Intoxication -= Intoxication/(timeLeft - TimeTicker) * args.DeltaSeconds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool BeforeDraw(in OverlayDrawArgs args)
|
protected override bool BeforeDraw(in OverlayDrawArgs args)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user