Class ItemSlotsSystem
A class that handles interactions related to inserting/ejecting items into/from an item slot.
Inheritance
System.Object
ItemSlotsSystem
Assembly: Content.Shared.dll
Syntax
public sealed class ItemSlotsSystem : EntitySystem
Methods
|
Improve this Doc
View Source
AddItemSlot(EntityUid, String, ItemSlot, ItemSlotsComponent)
Given a new item slot, store it in the ItemSlotsComponent and ensure the slot has an item
container.
Declaration
public void AddItemSlot(EntityUid uid, string id, ItemSlot slot, ItemSlotsComponent itemSlots = null)
Parameters
|
Improve this Doc
View Source
CanEject(EntityUid, Nullable<EntityUid>, ItemSlot)
Declaration
public bool CanEject(EntityUid uid, EntityUid? user, ItemSlot slot)
Parameters
Type |
Name |
Description |
EntityUid |
uid |
|
System.Nullable<EntityUid> |
user |
|
ItemSlot |
slot |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
CanInsert(EntityUid, EntityUid, Nullable<EntityUid>, ItemSlot, Boolean, Nullable<EntityUid>)
Check whether a given item can be inserted into a slot. Unless otherwise specified, this will return
false if the slot is already filled.
Declaration
public bool CanInsert(EntityUid uid, EntityUid usedUid, EntityUid? user, ItemSlot slot, bool swap = false, EntityUid? popup = null)
Parameters
Type |
Name |
Description |
EntityUid |
uid |
|
EntityUid |
usedUid |
|
System.Nullable<EntityUid> |
user |
|
ItemSlot |
slot |
|
System.Boolean |
swap |
|
System.Nullable<EntityUid> |
popup |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
GetItemOrNull(EntityUid, String, ItemSlotsComponent)
Get the contents of some item slot.
Declaration
public EntityUid? GetItemOrNull(EntityUid uid, string id, ItemSlotsComponent itemSlots = null)
Parameters
Returns
Type |
Description |
System.Nullable<EntityUid> |
The item in the slot, or null if the slot is empty or the entity doesn't have an ItemSlotsComponent.
|
|
Improve this Doc
View Source
Initialize()
Declaration
public override void Initialize()
|
Improve this Doc
View Source
RemoveItemSlot(EntityUid, ItemSlot, ItemSlotsComponent)
Remove an item slot. This should generally be called whenever a component that added a slot is being
removed.
Declaration
public void RemoveItemSlot(EntityUid uid, ItemSlot slot, ItemSlotsComponent itemSlots = null)
Parameters
|
Improve this Doc
View Source
SetLock(EntityUid, ItemSlot, Boolean, ItemSlotsComponent)
Lock an item slot. This stops items from being inserted into or ejected from this slot.
Declaration
public void SetLock(EntityUid uid, ItemSlot slot, bool locked, ItemSlotsComponent itemSlots = null)
Parameters
|
Improve this Doc
View Source
SetLock(EntityUid, String, Boolean, ItemSlotsComponent)
Lock an item slot. This stops items from being inserted into or ejected from this slot.
Declaration
public void SetLock(EntityUid uid, string id, bool locked, ItemSlotsComponent itemSlots = null)
Parameters
Type |
Name |
Description |
EntityUid |
uid |
|
System.String |
id |
|
System.Boolean |
locked |
|
ItemSlotsComponent |
itemSlots |
|
|
Improve this Doc
View Source
TryEject(EntityUid, ItemSlot, Nullable<EntityUid>, out Nullable<EntityUid>, Boolean)
Try to eject an item from a slot.
Declaration
public bool TryEject(EntityUid uid, ItemSlot slot, EntityUid? user, out EntityUid? item, bool excludeUserAudio = false)
Parameters
Type |
Name |
Description |
EntityUid |
uid |
|
ItemSlot |
slot |
|
System.Nullable<EntityUid> |
user |
|
System.Nullable<EntityUid> |
item |
|
System.Boolean |
excludeUserAudio |
|
Returns
Type |
Description |
System.Boolean |
False if item slot is locked or has no item inserted
|
|
Improve this Doc
View Source
TryEject(EntityUid, String, Nullable<EntityUid>, out Nullable<EntityUid>, ItemSlotsComponent, Boolean)
Try to eject item from a slot.
Declaration
public bool TryEject(EntityUid uid, string id, EntityUid? user, out EntityUid? item, ItemSlotsComponent itemSlots = null, bool excludeUserAudio = false)
Parameters
Type |
Name |
Description |
EntityUid |
uid |
|
System.String |
id |
|
System.Nullable<EntityUid> |
user |
|
System.Nullable<EntityUid> |
item |
|
ItemSlotsComponent |
itemSlots |
|
System.Boolean |
excludeUserAudio |
|
Returns
Type |
Description |
System.Boolean |
False if the id is not valid, the item slot is locked, or it has no item inserted
|
|
Improve this Doc
View Source
TryEjectToHands(EntityUid, ItemSlot, Nullable<EntityUid>, Boolean)
Try to eject item from a slot directly into a user's hands. If they have no hands, the item will still
be ejected onto the floor.
Declaration
public bool TryEjectToHands(EntityUid uid, ItemSlot slot, EntityUid? user, bool excludeUserAudio = false)
Parameters
Type |
Name |
Description |
EntityUid |
uid |
|
ItemSlot |
slot |
|
System.Nullable<EntityUid> |
user |
|
System.Boolean |
excludeUserAudio |
|
Returns
Type |
Description |
System.Boolean |
False if the id is not valid, the item slot is locked, or it has no item inserted. True otherwise, even
if the user has no hands.
|
|
Improve this Doc
View Source
TryGetSlot(EntityUid, String, out ItemSlot, ItemSlotsComponent)
Declaration
public bool TryGetSlot(EntityUid uid, string slotId, out ItemSlot itemSlot, ItemSlotsComponent component = null)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
TryInsert(EntityUid, ItemSlot, EntityUid, Nullable<EntityUid>)
Tries to insert item into a specific slot.
Declaration
public bool TryInsert(EntityUid uid, ItemSlot slot, EntityUid item, EntityUid? user)
Parameters
Type |
Name |
Description |
EntityUid |
uid |
|
ItemSlot |
slot |
|
EntityUid |
item |
|
System.Nullable<EntityUid> |
user |
|
Returns
Type |
Description |
System.Boolean |
False if failed to insert item
|
|
Improve this Doc
View Source
TryInsert(EntityUid, String, EntityUid, Nullable<EntityUid>, ItemSlotsComponent)
Tries to insert item into a specific slot.
Declaration
public bool TryInsert(EntityUid uid, string id, EntityUid item, EntityUid? user, ItemSlotsComponent itemSlots = null)
Parameters
Type |
Name |
Description |
EntityUid |
uid |
|
System.String |
id |
|
EntityUid |
item |
|
System.Nullable<EntityUid> |
user |
|
ItemSlotsComponent |
itemSlots |
|
Returns
Type |
Description |
System.Boolean |
False if failed to insert item
|
|
Improve this Doc
View Source
TryInsertFromHand(EntityUid, ItemSlot, EntityUid, HandsComponent)
Tries to insert item into a specific slot from an entity's hand.
Does not check action blockers.
Declaration
public bool TryInsertFromHand(EntityUid uid, ItemSlot slot, EntityUid user, HandsComponent hands = null)
Parameters
Returns
Type |
Description |
System.Boolean |
False if failed to insert item
|