Improved solution container visuals (#13791)

This commit is contained in:
adamsong
2023-03-22 23:49:42 -04:00
committed by GitHub
parent ec71302b4f
commit 980c3ef799
5 changed files with 11 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
using Content.Shared.Chemistry; using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent; using Content.Shared.Chemistry.Reagent;
using Content.Shared.Rounding;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
@@ -41,7 +42,6 @@ public sealed class SolutionContainerVisualsSystem : VisualizerSystem<SolutionCo
Logger.Error("Attempted to set solution container visuals volume ratio on " + ToPrettyString(uid) + " to a value greater than 1. Volume should never be greater than max volume!"); Logger.Error("Attempted to set solution container visuals volume ratio on " + ToPrettyString(uid) + " to a value greater than 1. Volume should never be greater than max volume!");
fraction = 1f; fraction = 1f;
} }
if (component.Metamorphic) if (component.Metamorphic)
{ {
if (args.Sprite.LayerMapTryGet(component.BaseLayer, out var baseLayer)) if (args.Sprite.LayerMapTryGet(component.BaseLayer, out var baseLayer))
@@ -79,7 +79,7 @@ public sealed class SolutionContainerVisualsSystem : VisualizerSystem<SolutionCo
} }
} }
var closestFillSprite = (int) Math.Round(fraction * component.MaxFillLevels); int closestFillSprite = ContentHelpers.RoundToLevels(fraction, 1, component.MaxFillLevels + 1);
if (closestFillSprite > 0) if (closestFillSprite > 0)
{ {

View File

@@ -254,6 +254,13 @@
- type: Drink - type: Drink
- type: Sprite - type: Sprite
sprite: Objects/Consumable/Drinks/water_cup.rsi sprite: Objects/Consumable/Drinks/water_cup.rsi
state: icon-1 layers:
- state: icon-0
- map: ["enum.SolutionContainerLayers.Fill"]
state: icon-1
- type: Appearance
- type: SolutionContainerVisuals
maxFillLevels: 1
fillBaseName: icon-
- type: TrashOnEmpty - type: TrashOnEmpty
solution: drink solution: drink

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 165 B

View File

@@ -14,4 +14,4 @@
"name": "icon-1" "name": "icon-1"
} }
] ]
} }