]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Improved solution container visuals (#13791)
authoradamsong <adamsong@users.noreply.github.com>
Thu, 23 Mar 2023 03:49:42 +0000 (23:49 -0400)
committerGitHub <noreply@github.com>
Thu, 23 Mar 2023 03:49:42 +0000 (14:49 +1100)
Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs
Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cups.yml
Resources/Textures/Objects/Consumable/Drinks/water_cup.rsi/icon-0.png
Resources/Textures/Objects/Consumable/Drinks/water_cup.rsi/icon-1.png
Resources/Textures/Objects/Consumable/Drinks/water_cup.rsi/meta.json

index 5686c9c36350703848bb9631937f29d3f5b27e8a..3eea146050ef78173871d232cb8ec00b030be047 100644 (file)
@@ -1,5 +1,6 @@
 using Content.Shared.Chemistry;
 using Content.Shared.Chemistry.Reagent;
+using Content.Shared.Rounding;
 using Robust.Client.GameObjects;
 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!");
             fraction = 1f;
         }
-
         if (component.Metamorphic)
         {
             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)
         {
index 58395f6f9b3e0245e8e6d04c0c07903c1eec66e9..f70c0e179dc868a69638f82e8711547649016117 100644 (file)
   - type: Drink
   - type: Sprite
     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
     solution: drink
index 8b0a5636be026852b2a49fe460b185965489c870..dac639fd21e0b2d67b914b660ae1993adf80cc86 100644 (file)
Binary files a/Resources/Textures/Objects/Consumable/Drinks/water_cup.rsi/icon-0.png and b/Resources/Textures/Objects/Consumable/Drinks/water_cup.rsi/icon-0.png differ
index dac639fd21e0b2d67b914b660ae1993adf80cc86..6456f4e651d69975f20b1b6c7af8f7b702817489 100644 (file)
Binary files a/Resources/Textures/Objects/Consumable/Drinks/water_cup.rsi/icon-1.png and b/Resources/Textures/Objects/Consumable/Drinks/water_cup.rsi/icon-1.png differ
index 80ac521b6fb53bbcddd6a491586f034dc1c8ccb2..7c719f160d5bb4bde0dea6f75017f47883a9507b 100644 (file)
@@ -14,4 +14,4 @@
             "name": "icon-1"
         }
     ]
-}
\ No newline at end of file
+}