]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix ItemMapper whitelist mispredict when inserting or removing items (#29461)
authorShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
Sun, 30 Jun 2024 04:34:06 +0000 (21:34 -0700)
committerGitHub <noreply@github.com>
Sun, 30 Jun 2024 04:34:06 +0000 (14:34 +1000)
* Fix ItemMapper whitelist mispredict when inserting or removing items

Makes the ItemMapper MapLayerData available on client so that the client
can predict whether an inserted/removed item changes the visibility of
a sprite layer.

* review

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
Content.Shared/Storage/Components/SharedMapLayerData.cs
Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs

index 6d2f4a7eafdf74e4dad5ff4ec3d0df9f1bad1448..da176759f7fe77bb2f912e36282e73e74c418b18 100644 (file)
@@ -17,21 +17,21 @@ namespace Content.Shared.Storage.Components
     {
         public string Layer = string.Empty;
 
-        [DataField("whitelist", required: true, serverOnly: true)]
-        public EntityWhitelist ServerWhitelist { get; set; } = new();
+        [DataField(required: true)]
+        public EntityWhitelist? Whitelist { get; set; }
 
         /// <summary>
         ///     Minimal amount of entities that are valid for whitelist.
         ///     If it's smaller than minimal amount, layer will be hidden.
         /// </summary>
-        [DataField("minCount")]
+        [DataField]
         public int MinCount = 1;
 
         /// <summary>
         ///     Max amount of entities that are valid for whitelist.
         ///     If it's bigger than max amount, layer will be hidden.
         /// </summary>
-        [DataField("maxCount")]
+        [DataField]
         public int MaxCount = int.MaxValue;
     }
 
index 2557f8100c66db6fec1ed3d1c33334549485cda0..cfa082a9eebb6d75b85828fdb1565cd43e7e840e 100644 (file)
@@ -95,7 +95,7 @@ namespace Content.Shared.Storage.EntitySystems
             var list = new List<string>();
             foreach (var mapLayerData in itemMapper.MapLayers.Values)
             {
-                var count = containedLayers.Count(ent => _whitelistSystem.IsWhitelistPass(mapLayerData.ServerWhitelist, ent));
+                var count = containedLayers.Count(ent => _whitelistSystem.IsWhitelistPass(mapLayerData.Whitelist, ent));
                 if (count >= mapLayerData.MinCount && count <= mapLayerData.MaxCount)
                 {
                     list.Add(mapLayerData.Layer);