Show / Hide Table of Contents

Class ItemSlot

This is effectively a wrapper for a ContainerSlot that adds content functionality like entity whitelists and insert/eject sounds.

Inheritance
System.Object
ItemSlot
Namespace: Content.Shared.Containers.ItemSlots
Assembly: Content.Shared.dll
Syntax
public sealed class ItemSlot : object

Constructors

| Improve this Doc View Source

ItemSlot()

Declaration
public ItemSlot()
| Improve this Doc View Source

ItemSlot(ItemSlot)

Declaration
public ItemSlot(ItemSlot other)
Parameters
Type Name Description
ItemSlot other

Fields

| Improve this Doc View Source

ContainerSlot

Declaration
public ContainerSlot ContainerSlot
Field Value
Type Description
Robust.Shared.Containers.ContainerSlot
| Improve this Doc View Source

DisableEject

Prevents adding the eject alt-verb, but still lets you swap items.

Declaration
public bool DisableEject
Field Value
Type Description
System.Boolean
Remarks

This does not affect EjectOnInteract, since if you do that you probably want ejecting to work.

| Improve this Doc View Source

EjectOnBreak

If this slot belongs to some breakable or destructible entity, should the item inside the slot be ejected when it is broken or destroyed?

Declaration
public bool EjectOnBreak
Field Value
Type Description
System.Boolean
| Improve this Doc View Source

EjectOnDeconstruct

If this slot belongs to some de-constructible component, should the item inside the slot be ejected upon deconstruction?

Declaration
public bool EjectOnDeconstruct
Field Value
Type Description
System.Boolean
Remarks

The actual deconstruction logic is handled by the server-side EmptyOnMachineDeconstructSystem.

| Improve this Doc View Source

EjectOnInteract

Whether the item slots system will attempt to eject this item to the user's hands when interacted with.

Declaration
public bool EjectOnInteract
Field Value
Type Description
System.Boolean
Remarks

For most item slots, this is probably not the case (eject is usually an alt-click interaction). But there are some exceptions. For example item cabinets and charging stations should probably eject their contents when clicked on normally.

| Improve this Doc View Source

EjectOnUse

If true, and if this slot is attached to an item, then it will attempt to eject slot when to the slot is used in the user's hands.

Declaration
public bool EjectOnUse
Field Value
Type Description
System.Boolean
Remarks

Desirable for things like ranged weapons ('Z' to eject), but not desirable for others (e.g., PDA uses 'Z' to open UI). Unlike EjectOnInteract, this will not make any changes to the context menu, nor will it disable alt-click interactions.

| Improve this Doc View Source

EjectSound

Declaration
public SoundSpecifier EjectSound
Field Value
Type Description
Robust.Shared.Audio.SoundSpecifier
| Improve this Doc View Source

EjectVerbText

Override the eject verb text. Defaults to using the slot's name (if specified) or the name of the targeted item. If specified, the verb will not be added to the default eject verb category

Declaration
public string? EjectVerbText
Field Value
Type Description
System.Nullable<System.String>
| Improve this Doc View Source

InsertOnInteract

Whether the item slots system will attempt to insert item from the user's hands into this slot when interacted with. It doesn't block other insertion methods, like verbs.

Declaration
public bool InsertOnInteract
Field Value
Type Description
System.Boolean
| Improve this Doc View Source

InsertSound

Declaration
public SoundSpecifier InsertSound
Field Value
Type Description
Robust.Shared.Audio.SoundSpecifier
| Improve this Doc View Source

InsertVerbText

Override the insert verb text. Defaults to using the slot's name (if specified) or the name of the targeted item. If specified, the verb will not be added to the default insert verb category.

Declaration
public string? InsertVerbText
Field Value
Type Description
System.Nullable<System.String>
| Improve this Doc View Source

Local

If false, errors when adding an item slot with a duplicate key are suppressed. Local==true implies that the slot was added via client component state handling.

Declaration
public bool Local
Field Value
Type Description
System.Boolean
| Improve this Doc View Source

Locked

Whether or not an item can currently be ejected or inserted from this slot.

Declaration
public bool Locked
Field Value
Type Description
System.Boolean
Remarks

This doesn't have to mean the slot is somehow physically locked. In the case of the item cabinet, the cabinet may simply be closed at the moment and needs to be opened first.

| Improve this Doc View Source

Name

The name of this item slot. This will be shown to the user in the verb menu.

Declaration
public string Name
Field Value
Type Description
System.String
Remarks

This will be passed through Loc.GetString. If the name is an empty string, then verbs will use the name of the currently held or currently inserted entity instead.

| Improve this Doc View Source

Priority

Declaration
public int Priority
Field Value
Type Description
System.Int32
| Improve this Doc View Source

StartingItem

The entity prototype that is spawned into this slot on map init.

Declaration
public string? StartingItem
Field Value
Type Description
System.Nullable<System.String>
Remarks

Marked as readOnly because some components (e.g. PowerCellSlot) set the starting item based on some property of that component (e.g., cell slot size category), and this can lead to unnecessary changes when mapping.

| Improve this Doc View Source

Swap

If the user interacts with an entity with an already-filled item slot, should they attempt to swap out the item?

Declaration
public bool Swap
Field Value
Type Description
System.Boolean
Remarks

Useful for things like chem dispensers, but undesirable for things like the ID card console, where you want to insert more than one item that matches the same whitelist.

| Improve this Doc View Source

Whitelist

Declaration
public EntityWhitelist Whitelist
Field Value
Type Description
EntityWhitelist
| Improve this Doc View Source

WhitelistFailPopup

If this is not an empty string, this will generate a popup when someone attempts to insert a bad item into this slot. This string will be passed through localization.

Declaration
public string WhitelistFailPopup
Field Value
Type Description
System.String

Properties

| Improve this Doc View Source

HasItem

Declaration
public bool HasItem { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

ID

Declaration
public string? ID { get; }
Property Value
Type Description
System.Nullable<System.String>
| Improve this Doc View Source

Item

Declaration
public EntityUid? Item { get; }
Property Value
Type Description
System.Nullable<EntityUid>

Methods

| Improve this Doc View Source

CopyFrom(ItemSlot)

Declaration
public void CopyFrom(ItemSlot other)
Parameters
Type Name Description
ItemSlot other
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾