Class ItemMapperComponent
ItemMapperComponent
is a
To define a mapping, create a mapLayers
map in configuration ItemMapper
component and with MapLayers mapping.
Each map layer maps layer name to an EntityWhitelist, 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 ItemCounterComponent
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
- type: Appearance
visuals:
- type: MappedItemVisualizer
To map Powerdrill
TagComponent to the given example, we need the following code.
- type: ItemMapper
mapLayers:
drill:
whitelist:
tags:
- Powerdrill
#... to be continued
To map Lightbulb
#... 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.
EntityWhitelist
SharedMapLayerData
Inheritance
Namespace: Content.Shared.Storage.Components
Assembly: Content.Shared.dll
Syntax
public sealed class ItemMapperComponent : Component
Fields
| Improve this Doc View SourceContainerWhitelist
If this exists, shown layers will only consider entities in the given containers.
Declaration
public HashSet<string>? ContainerWhitelist
Field Value
Type | Description |
---|---|
System.Nullable<HashSet<System.String>> |
MapLayers
Declaration
public Dictionary<string, SharedMapLayerData> MapLayers
Field Value
Type | Description |
---|---|
Dictionary<System.String, SharedMapLayerData> |
RSIPath
Declaration
public ResPath? RSIPath
Field Value
Type | Description |
---|---|
System.Nullable<Robust.Shared.Utility.ResPath> |
SpriteLayers
The list of map layer keys that are valid targets for changing in MapLayers Can be initialized if already existing on the sprite, or inferred automatically
Declaration
public List<string> SpriteLayers
Field Value
Type | Description |
---|---|
List<System.String> |