From a625cc90312fb3e2939ddde9cad386b4c26f3b31 Mon Sep 17 00:00:00 2001 From: zero Date: Fri, 1 Dec 2023 02:35:51 -0600 Subject: [PATCH] Sort reagent prototypes for solutions (#22049) --- .../EntitySystems/SolutionContainerSystem.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.cs b/Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.cs index a5c35b5e6c..bb90351483 100644 --- a/Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.cs +++ b/Content.Shared/Chemistry/EntitySystems/SolutionContainerSystem.cs @@ -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(); - foreach (var proto in solution.GetReagentPrototypes(_prototypeManager).Keys) + foreach (var keyValuePair in sortedReagentPrototypes) { + var proto = keyValuePair.Key; if (!proto.Recognizable) { continue; -- 2.51.2