Skip unnecessary MaterialStorageControl updates (#32662)
Remove unnecessary dictionary copying
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user