Cleanup warnings in DamageStateVisualizerSystem (#37435)
Cleanup warnings in DamageStateVisualizerSystem
This commit is contained in:
@@ -6,6 +6,8 @@ namespace Content.Client.DamageState;
|
|||||||
|
|
||||||
public sealed class DamageStateVisualizerSystem : VisualizerSystem<DamageStateVisualsComponent>
|
public sealed class DamageStateVisualizerSystem : VisualizerSystem<DamageStateVisualsComponent>
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
protected override void OnAppearanceChange(EntityUid uid, DamageStateVisualsComponent component, ref AppearanceChangeEvent args)
|
protected override void OnAppearanceChange(EntityUid uid, DamageStateVisualsComponent component, ref AppearanceChangeEvent args)
|
||||||
{
|
{
|
||||||
var sprite = args.Sprite;
|
var sprite = args.Sprite;
|
||||||
@@ -23,18 +25,18 @@ public sealed class DamageStateVisualizerSystem : VisualizerSystem<DamageStateVi
|
|||||||
// Brain no worky rn so this was just easier.
|
// Brain no worky rn so this was just easier.
|
||||||
foreach (var key in new[] { DamageStateVisualLayers.Base, DamageStateVisualLayers.BaseUnshaded })
|
foreach (var key in new[] { DamageStateVisualLayers.Base, DamageStateVisualLayers.BaseUnshaded })
|
||||||
{
|
{
|
||||||
if (!sprite.LayerMapTryGet(key, out _)) continue;
|
if (!_sprite.LayerMapTryGet((uid, sprite), key, out _, false)) continue;
|
||||||
|
|
||||||
sprite.LayerSetVisible(key, false);
|
_sprite.LayerSetVisible((uid, sprite), key, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var (key, state) in layers)
|
foreach (var (key, state) in layers)
|
||||||
{
|
{
|
||||||
// Inheritance moment.
|
// Inheritance moment.
|
||||||
if (!sprite.LayerMapTryGet(key, out _)) continue;
|
if (!_sprite.LayerMapTryGet((uid, sprite), key, out _, false)) continue;
|
||||||
|
|
||||||
sprite.LayerSetVisible(key, true);
|
_sprite.LayerSetVisible((uid, sprite), key, true);
|
||||||
sprite.LayerSetState(key, state);
|
_sprite.LayerSetRsiState((uid, sprite), key, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// So they don't draw over mobs anymore
|
// So they don't draw over mobs anymore
|
||||||
@@ -43,12 +45,12 @@ public sealed class DamageStateVisualizerSystem : VisualizerSystem<DamageStateVi
|
|||||||
if (sprite.DrawDepth > (int)DrawDepth.DeadMobs)
|
if (sprite.DrawDepth > (int)DrawDepth.DeadMobs)
|
||||||
{
|
{
|
||||||
component.OriginalDrawDepth = sprite.DrawDepth;
|
component.OriginalDrawDepth = sprite.DrawDepth;
|
||||||
sprite.DrawDepth = (int) DrawDepth.DeadMobs;
|
_sprite.SetDrawDepth((uid, sprite), (int)DrawDepth.DeadMobs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (component.OriginalDrawDepth != null)
|
else if (component.OriginalDrawDepth != null)
|
||||||
{
|
{
|
||||||
sprite.DrawDepth = component.OriginalDrawDepth.Value;
|
_sprite.SetDrawDepth((uid, sprite), component.OriginalDrawDepth.Value);
|
||||||
component.OriginalDrawDepth = null;
|
component.OriginalDrawDepth = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user