Cleanup warnings in AnomalySystem (#37429)
Cleanup warnings in AnomalySystem
This commit is contained in:
@@ -11,6 +11,7 @@ public sealed class AnomalySystem : SharedAnomalySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly FloatingVisualizerSystem _floating = default!;
|
[Dependency] private readonly FloatingVisualizerSystem _floating = default!;
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -49,12 +50,12 @@ public sealed class AnomalySystem : SharedAnomalySystem
|
|||||||
if (HasComp<AnomalySupercriticalComponent>(uid))
|
if (HasComp<AnomalySupercriticalComponent>(uid))
|
||||||
pulsing = true;
|
pulsing = true;
|
||||||
|
|
||||||
if (!sprite.LayerMapTryGet(AnomalyVisualLayers.Base, out var layer) ||
|
if (!_sprite.LayerMapTryGet((uid, sprite), AnomalyVisualLayers.Base, out var layer, false) ||
|
||||||
!sprite.LayerMapTryGet(AnomalyVisualLayers.Animated, out var animatedLayer))
|
!_sprite.LayerMapTryGet((uid, sprite), AnomalyVisualLayers.Animated, out var animatedLayer, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sprite.LayerSetVisible(layer, !pulsing);
|
_sprite.LayerSetVisible((uid, sprite), layer, !pulsing);
|
||||||
sprite.LayerSetVisible(animatedLayer, pulsing);
|
_sprite.LayerSetVisible((uid, sprite), animatedLayer, pulsing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
@@ -63,16 +64,16 @@ public sealed class AnomalySystem : SharedAnomalySystem
|
|||||||
|
|
||||||
var query = EntityQueryEnumerator<AnomalySupercriticalComponent, SpriteComponent>();
|
var query = EntityQueryEnumerator<AnomalySupercriticalComponent, SpriteComponent>();
|
||||||
|
|
||||||
while (query.MoveNext(out var super, out var sprite))
|
while (query.MoveNext(out var uid, out var super, out var sprite))
|
||||||
{
|
{
|
||||||
var completion = 1f - (float) ((super.EndTime - _timing.CurTime) / super.SupercriticalDuration);
|
var completion = 1f - (float)((super.EndTime - _timing.CurTime) / super.SupercriticalDuration);
|
||||||
var scale = completion * (super.MaxScaleAmount - 1f) + 1f;
|
var scale = completion * (super.MaxScaleAmount - 1f) + 1f;
|
||||||
sprite.Scale = new Vector2(scale, scale);
|
_sprite.SetScale((uid, sprite), new Vector2(scale, scale));
|
||||||
|
|
||||||
var transparency = (byte) (65 * (1f - completion) + 190);
|
var transparency = (byte)(65 * (1f - completion) + 190);
|
||||||
if (transparency < sprite.Color.AByte)
|
if (transparency < sprite.Color.AByte)
|
||||||
{
|
{
|
||||||
sprite.Color = sprite.Color.WithAlpha(transparency);
|
_sprite.SetColor((uid, sprite), sprite.Color.WithAlpha(transparency));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,7 +83,7 @@ public sealed class AnomalySystem : SharedAnomalySystem
|
|||||||
if (!TryComp<SpriteComponent>(ent, out var sprite))
|
if (!TryComp<SpriteComponent>(ent, out var sprite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sprite.Scale = Vector2.One;
|
_sprite.SetScale((ent.Owner, sprite), Vector2.One);
|
||||||
sprite.Color = sprite.Color.WithAlpha(1f);
|
_sprite.SetColor((ent.Owner, sprite), sprite.Color.WithAlpha(1f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user