From adc80ea56626ce3b65b86e22283a6f987aef6448 Mon Sep 17 00:00:00 2001 From: Jabak <163307958+Jabaks@users.noreply.github.com> Date: Wed, 26 Jun 2024 23:03:06 +0300 Subject: [PATCH] Fix ItemMapper whitelist mispredict when inserting or removing items --- Content.Shared/Storage/Components/SharedMapLayerData.cs | 4 ++-- .../Storage/EntitySystems/SharedItemMapperSystem.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Content.Shared/Storage/Components/SharedMapLayerData.cs b/Content.Shared/Storage/Components/SharedMapLayerData.cs index 6d2f4a7eaf..69ecf795c8 100644 --- a/Content.Shared/Storage/Components/SharedMapLayerData.cs +++ b/Content.Shared/Storage/Components/SharedMapLayerData.cs @@ -17,8 +17,8 @@ namespace Content.Shared.Storage.Components { public string Layer = string.Empty; - [DataField("whitelist", required: true, serverOnly: true)] - public EntityWhitelist ServerWhitelist { get; set; } = new(); + [DataField("whitelist", required: true)] + public EntityWhitelist? ServerWhitelist { get; set; } /// /// Minimal amount of entities that are valid for whitelist. diff --git a/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs b/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs index a5e151f4ea..a00893cbb7 100644 --- a/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs @@ -93,7 +93,7 @@ namespace Content.Shared.Storage.EntitySystems var list = new List(); foreach (var mapLayerData in itemMapper.MapLayers.Values) { - var count = containedLayers.Count(ent => mapLayerData.ServerWhitelist.IsValid(ent)); + var count = containedLayers.Count(ent => mapLayerData.ServerWhitelist!.IsValid(ent)); if (count >= mapLayerData.MinCount && count <= mapLayerData.MaxCount) { list.Add(mapLayerData.Layer);