]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Sort reagent prototypes for solutions (#22049)
authorzero <hello@enumerate.dev>
Fri, 1 Dec 2023 08:35:51 +0000 (02:35 -0600)
committerGitHub <noreply@github.com>
Fri, 1 Dec 2023 08:35:51 +0000 (01:35 -0700)
Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.cs

index a5c35b5e6ce9932b642f0b92cf7044ec34518839..bb90351483546ad0d4a2333cf1e31e6b2d8d9860 100644 (file)
@@ -174,10 +174,19 @@ public sealed partial class SolutionContainerSystem : EntitySystem
                 : "shared-solution-container-component-on-examine-worded-amount-multiple-reagents")),
             ("desc", primary.LocalizedPhysicalDescription)));
 
+
+        var reagentPrototypes = solution.GetReagentPrototypes(_prototypeManager);
+
+        // Sort the reagents by amount, descending then alphabetically
+        var sortedReagentPrototypes = reagentPrototypes
+            .OrderByDescending(pair => pair.Value.Value)
+            .ThenBy(pair => pair.Key.LocalizedName);
+
         // Add descriptions of immediately recognizable reagents, like water or beer
         var recognized = new List<ReagentPrototype>();
-        foreach (var proto in solution.GetReagentPrototypes(_prototypeManager).Keys)
+        foreach (var keyValuePair in sortedReagentPrototypes)
         {
+            var proto = keyValuePair.Key;
             if (!proto.Recognizable)
             {
                 continue;