]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Skip unnecessary MaterialStorageControl updates (#32662)
authorBen Bryant <30258875+benbryant0@users.noreply.github.com>
Thu, 17 Apr 2025 10:41:15 +0000 (12:41 +0200)
committerGitHub <noreply@github.com>
Thu, 17 Apr 2025 10:41:15 +0000 (20:41 +1000)
Remove unnecessary dictionary copying

Content.Client/Materials/UI/MaterialStorageControl.xaml.cs

index 0237b86db76d4fcd66e7a20a413bc0e58e392b26..3cf1792c144c50311eee2aba0d21efbd83c7f5bd 100644 (file)
@@ -3,6 +3,7 @@ using Content.Shared.Materials;
 using Robust.Client.AutoGenerated;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Prototypes;
 using Robust.Shared.Timing;
 
 namespace Content.Client.Materials.UI;
@@ -17,7 +18,7 @@ public sealed partial class MaterialStorageControl : ScrollContainer
 
     private EntityUid? _owner;
 
-    private Dictionary<string, int> _currentMaterials = new();
+    private Dictionary<ProtoId<MaterialPrototype>, int> _currentMaterials = new();
 
     public MaterialStorageControl()
     {
@@ -44,7 +45,7 @@ public sealed partial class MaterialStorageControl : ScrollContainer
         }
 
         var canEject = materialStorage.CanEjectStoredMaterials;
-        var mats = materialStorage.Storage.Select(pair => (pair.Key.Id, pair.Value)).ToDictionary();
+        var mats = materialStorage.Storage;
         if (_currentMaterials.Equals(mats))
             return;