Cleanup more SpriteComponent warnings (part 2) (#37522)
* Cleanup warnings in DamageMarkerSystem * Cleanup warnings in CuffableSystem * Cleanup warnings in DeployableTurretSystem * Cleanup warnings in StorageContainerVisualsSystem * Cleanup warnings in ItemMapperSystem * Cleanup warnings in ItemCounterSystem * Cleanup warnings in RandomSpriteSystem * Cleanup warnings in PowerCellSystem * Cleanup warnings in ParticleAcceleratorPartVisualizerSystem * Cleanup warnings in PaperVisualizerSystem * Cleanup warnings in PoweredLightVisualizerSystem * Cleanup warnings in LightBulbSystem * Cleanup warnings in EmergencyLightSystem * Cleanup warnings in DoorSystem * Cleanup warnings in ClockSystem * Cleanup warnings in BuckleSystem * Cleanup warnings in JukeboxSystem
This commit is contained in:
@@ -8,6 +8,8 @@ namespace Content.Client.Storage.Systems;
|
||||
/// <inheritdoc cref="StorageContainerVisualsComponent"/>
|
||||
public sealed class StorageContainerVisualsSystem : VisualizerSystem<StorageContainerVisualsComponent>
|
||||
{
|
||||
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||
|
||||
protected override void OnAppearanceChange(EntityUid uid, StorageContainerVisualsComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
if (args.Sprite == null)
|
||||
@@ -19,9 +21,9 @@ public sealed class StorageContainerVisualsSystem : VisualizerSystem<StorageCont
|
||||
if (!AppearanceSystem.TryGetData<int>(uid, StorageVisuals.Capacity, out var capacity, args.Component))
|
||||
return;
|
||||
|
||||
var fraction = used / (float) capacity;
|
||||
var fraction = used / (float)capacity;
|
||||
|
||||
if (!args.Sprite.LayerMapTryGet(component.FillLayer, out var fillLayer))
|
||||
if (!_sprite.LayerMapTryGet((uid, args.Sprite), component.FillLayer, out var fillLayer, false))
|
||||
return;
|
||||
|
||||
var closestFillSprite = Math.Min(ContentHelpers.RoundToNearestLevels(fraction, 1, component.MaxFillLevels + 1),
|
||||
@@ -32,13 +34,13 @@ public sealed class StorageContainerVisualsSystem : VisualizerSystem<StorageCont
|
||||
if (component.FillBaseName == null)
|
||||
return;
|
||||
|
||||
args.Sprite.LayerSetVisible(fillLayer, true);
|
||||
_sprite.LayerSetVisible((uid, args.Sprite), fillLayer, true);
|
||||
var stateName = component.FillBaseName + closestFillSprite;
|
||||
args.Sprite.LayerSetState(fillLayer, stateName);
|
||||
_sprite.LayerSetRsiState((uid, args.Sprite), fillLayer, stateName);
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Sprite.LayerSetVisible(fillLayer, false);
|
||||
_sprite.LayerSetVisible((uid, args.Sprite), fillLayer, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user