Files
tbd-station-14/Content.Shared/Storage/Components/SharedMapLayerData.cs
ShadowCommander afe9f3ae85 Fix ItemMapper whitelist mispredict when inserting or removing items (#29461)
* 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>
2024-06-30 14:34:06 +10:00

60 lines
1.5 KiB
C#

using System.Collections.ObjectModel;
using Content.Shared.Whitelist;
using Robust.Shared.Serialization;
namespace Content.Shared.Storage.Components
{
[Serializable, NetSerializable]
public enum StorageMapVisuals : sbyte
{
InitLayers,
LayerChanged,
}
[Serializable]
[DataDefinition]
public sealed partial class SharedMapLayerData
{
public string Layer = string.Empty;
[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]
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]
public int MaxCount = int.MaxValue;
}
[Serializable, NetSerializable]
public sealed class ShowLayerData : ICloneable
{
public readonly IReadOnlyList<string> QueuedEntities;
public ShowLayerData()
{
QueuedEntities = new List<string>();
}
public ShowLayerData(IReadOnlyList<string> other)
{
QueuedEntities = other;
}
public object Clone()
{
// QueuedEntities should never be getting modified after this object is created.
return this;
}
}
}