using Content.Shared.Storage.EntitySystems; using Robust.Shared.Utility; namespace Content.Shared.Storage.Components { /// /// ItemMapperComponent is a that maps string labels to an of elements. Useful primarily for visualization. /// /// To define a mapping, create a mapLayers map in configuration ItemMapper component and with mapping. /// Each map layer maps layer name to an , plus special modifiers for min and max item count. /// Min and max count are useful when you need to visualize a certain number of items, for example, to display one, two, three, or more items. /// /// /// If you need a more straightforward way to change appearance where only variable is how many items, rather than which items /// and how many, see /// /// /// For a contrived example, create a tool-belt with a Power drill slot and two light bulb slots. /// To use this for visualization, we need a or VisualizerSystem, e.g. /// /// - type: Appearance /// visuals: /// - type: MappedItemVisualizer /// /// To map Powerdrill to the given example, we need the following code. /// /// - type: ItemMapper /// mapLayers: /// drill: /// whitelist: /// tags: /// - Powerdrill /// #... to be continued /// /// To map Lightbulb (not tag) to two different layers (for one and two light bulbs, respectively) /// /// #... to be continued /// lightbulb1: /// minCount: 1 /// whitelist: /// component: /// - Lightbulb /// lightbulb2: /// minCount: 2 /// whitelist: /// component: /// - Lightbulb /// /// The min count will ensure that lightbulb1 layer is only displayed when one or more light bulbs are in the belt. /// And lightbulb2 layer will only be shown when two or more light bulbs are inserted. /// /// /// /// [RegisterComponent] [Access(typeof(SharedItemMapperSystem))] public sealed partial class ItemMapperComponent : Component { [DataField("mapLayers")] public Dictionary MapLayers = new(); [DataField("sprite")] public ResPath? RSIPath; /// /// If this exists, shown layers will only consider entities in the given containers. /// [DataField("containerWhitelist")] public HashSet? ContainerWhitelist; /// /// The list of map layer keys that are valid targets for changing in /// Can be initialized if already existing on the sprite, or inferred automatically /// [DataField("spriteLayers")] public List SpriteLayers = new(); } }