Assembly: Sandbox.Game.dll

public class MyInventory: MyInventoryBase, IMyComponentBase, IMyEntityComponentBase, IMyEventProxy, IMyEventOwner, IMyInventory, IMyInventory

Fields

Member Description
static INVENTORY_CHANGED
Constraint Constraint filtering items added to inventory. If null, everything is allowed. Note that setting this constraint will not affect items already in the inventory.
ExternalMass
IsWildlifeAgentInventory
SyncType
UserData Any attached data..
CanPutItems Inherited from MyInventoryBase
IsInModifyInventory Inherited from MyInventoryBase
RemoveEntityOnEmpty Setting this flag to true causes to call Close() on the Entity of Container, when the GetItemsCount() == 0. This causes to remove entity from the world, when this inventory is empty.

Inherited from MyInventoryBase

Events

Member Description
static OnTransferByUser
static OnAfterAddedToContainer Inherited from MyEntityComponentBase
OnVolumeChanged
AfterModifyFinished Inherited from MyInventoryBase
BeforeContentsChanged Inherited from MyInventoryBase
BeforeRemovedFromContainer Inherited from IMyEntityComponentBase
BeforeRemovedFromContainer Inherited from MyEntityComponentBase
ContentsAdded Inherited from MyInventoryBase
ContentsChanged Called when items were added or removed, or their amount has changed

Inherited from MyInventoryBase
ContentsRemoved Inherited from MyInventoryBase
InventoryContentChanged Inherited from MyInventoryBase
OnVolumeChanged Triggers when volume of the inventory is changed

Inherited from IMyInventory
OwnerChanged Called if this inventory changed its owner

Inherited from MyInventoryBase

Properties

Member Description
CargoPercentage Returns a value in the range [0,1] that indicates how full this inventory is. 0 is empty 1 is full If there are no cargo constraints, will return empty
CurrentMass
CurrentVolume
ForcedPriority
InventoryIdx
IsCharacterOwner
IsConstrained
IsFull
ItemCount
MaxItemCount
MaxMass
MaxVolume
Owner
VolumeFillFactor
AttachSyncToEntity Inherited from MyInventoryBase
AttachSyncToEntity Inherited from MyEntityComponentBase
CanPutItems Gets if inventory can receive items or not.

Inherited from IMyInventory
CanPutItems Gets or sets if inventory can receive items or not.

Inherited from IMyInventory
ComponentTypeDebugString Inherited from IMyEntityComponentBase
ComponentTypeDebugString Inherited from MyInventoryBase
ComponentTypeDebugString Name of the base component type for debug purposes (e.g.: "Position")

Inherited from MyEntityComponentBase
Container Inherited from IMyEntityComponentBase
Container Inherited from MyEntityComponentBase
ContainerBase Inherited from IMyComponentBase
ContainerBase This cannot be named Container to not conflict with the definition of Container in MyEntityComponentBase.

Inherited from MyComponentBase
CurrentMass Returns total mass of items inside this inventory in Kg.

Inherited from IMyInventory
CurrentMass Inherited from MyInventoryBase
CurrentVolume Returns total volume of items inside this inventory in m^3.

Inherited from IMyInventory
CurrentVolume Inherited from MyInventoryBase
Entity Inherited from IMyEntityComponentBase
Entity Inherited from MyEntityComponentBase
FailedOnSceneAdd Inherited from MyComponentBase
ForcedPriority Inherited from MyInventoryBase
InventoryId This is for the purpose of identifying the inventory in aggregates (i.e. "Backpack", "LeftHand", ...)

Inherited from MyInventoryBase
IsFull Determines if inventory is absolutely full.

Inherited from IMyInventory
ItemCount Returns number of occupied inventory slots.

Inherited from IMyInventory
MaxItemCount Inherited from MyInventoryBase
MaxMass Inherited from MyInventoryBase
MaxVolume Sets maximum volume of items this inventory can contain in m^3.

Inherited from IMyInventory
MaxVolume Inherited from MyInventoryBase
Owner Returns entity this inventory belongs to.

Inherited from IMyInventory
Owner Returns entity this inventory belongs to.

Inherited from IMyInventory
RemoveExistingComponentOnNewInsert Inherited from IMyComponentBase
RemoveExistingComponentOnNewInsert Inherited from MyComponentBase
VolumeFillFactor Gets the current volume fill factor of the inventory

Inherited from IMyInventory

Constructors

Member Description
MyInventory()
MyInventory(float, Vector3, MyInventoryFlags)
MyInventory(float, float, Vector3, MyInventoryFlags)
MyInventory(MyFixedPoint, MyFixedPoint, Vector3, MyInventoryFlags)
MyInventory(MyFixedPoint, MyFixedPoint, MyInventoryFlags, List)
MyInventory(MyObjectBuilder_InventoryDefinition, MyInventoryFlags)
MyInventoryBase(string) Inherited from MyInventoryBase

Methods

Member Description
static GetItemVolumeAndMass(MyDefinitionId, out float, out float)
static ShowCantConsume()
static Transfer(MyInventory, MyInventory, MyDefinitionId, MyItemFlags, MyFixedPoint?, bool)
static Transfer(MyInventory, MyInventory, uint, int, MyFixedPoint?, bool)
static TransferAll(MyInventory, MyInventory)
static TransferByPlanner(MyInventory, MyInventory, SerializableDefinitionId, MyItemFlags, MyFixedPoint?, bool)
static TransferByUser(MyInventory, MyInventory, uint, int, MyFixedPoint?)
static TryConsumeItem(MyCharacter, MyInventory, MyDefinitionId, out bool, bool)
static TryTransferAll(MyInventory, MyInventory)
Add(IMyInventoryItem, MyFixedPoint)
AddBlocks(MyCubeBlockDefinition, MyFixedPoint)
AddItemClient(int, MyPhysicalInventoryItem)
AddItems(MyFixedPoint, MyObjectBuilder_Base)
ApplyChanges(List)
CanItemsBeAdded(MyFixedPoint, MyDefinitionId)
CanItemsBeAdded(MyFixedPoint, MyDefinitionId, MyFixedPoint, MyFixedPoint, MyFixedPoint, MyFixedPoint)
ChangeItemClient(MyPhysicalInventoryItem, int)
CheckConstraint(MyDefinitionId)
Clear(bool)
ClearItems()
ComputeAmountThatFits(MyDefinitionId, float, float)
ComputeAmountThatFits(MyBlueprintDefinitionBase)
ConsumeItem(MyDefinitionId, MyFixedPoint, long)
ContainItems(MyFixedPoint, MyObjectBuilder_PhysicalObject)
ContainItems(MyFixedPoint?, MyDefinitionId, MyItemFlags)
CountItems(Dictionary<MyDefinitionId, MyFixedPoint>)
DebugAddItems(MyFixedPoint, MyObjectBuilder_Base)
Deserialize(MyObjectBuilder_ComponentBase)
DropItem(int, MyFixedPoint)
DropItemById(uint, MyFixedPoint)
Empty()
FilterItemsUsingConstraint()
FindFreeSlotSpace(MyDefinitionId, IMyInventoryItemAdapter)
FindItem(MyDefinitionId)
FindItem(Func<MyPhysicalInventoryItem, bool>)
FindUsableItem(MyDefinitionId) This will try to find the first item that can be use. This means, if durability is enabled on items, it will look for first item with durability HP > 0, if this is disabled, this will behave the same as FindItem method
FixInventoryVolume(float)
GenerateContent(MyContainerTypeDefinition)
GetFlags()
GetInventoryCount() Returns number of embedded inventories - this inventory can be aggregation of other inventories.
GetItemAmount(MyDefinitionId, MyItemFlags, bool)
GetItemAt(int)
GetItemByID(uint)
GetItemByIndex(int)
GetItemIndexById(uint)
GetItems()
GetItemsCount()
GetObjectBuilder()
Init(MyObjectBuilder_Inventory)
Init(MyComponentDefinitionBase)
IsItemAt(int)
IsUniqueId(uint)
ItemsCanBeAdded(MyFixedPoint, IMyInventoryItem)
ItemsCanBeRemoved(MyFixedPoint, IMyInventoryItem)
IterateInventory(int, int) Search for inventory having given search index. Aggregate inventory: Iterates through aggregate inventory until simple inventory with matching index is found. Simple inventory: Returns itself if currentIndex == searchIndex. Usage: searchIndex = index of inventory being searched, leave currentIndex = 0.
ModifyContent(MyPhysicalInventoryItem, Action<MyObjectBuilder_PhysicalObject>, bool)
ModifyContentForRifle(MyPhysicalInventoryItem, Action<MyObjectBuilder_PhysicalObject>, bool) Other way of ModifyContent, it is created specifically for MyAutomaticRifleGun because of complexity of callbacks. Instead it would not force sync
ModifyDatapad(int, uint, string, string)
OnAddedToContainer()
OnBeforeContentsChanged()
OnContentsAdded(MyPhysicalInventoryItem, MyFixedPoint)
OnContentsChanged()
OnContentsRemoved(MyPhysicalInventoryItem, MyFixedPoint)
PickupItem(MyFloatingObject, MyFixedPoint)
RecordConsumedFood(MyFixedPoint, SerializableDefinitionId, ulong)
Refresh()
Remove(IMyInventoryItem, MyFixedPoint)
RemoveItemClient(uint)
RemoveItems(uint, MyFixedPoint?, bool, bool, MatrixD?, Action<MyDefinitionId, MyEntity>, bool)
RemoveItemsAt(int, MyFixedPoint?, bool, bool, bool)
RemoveItemsOfType(MyFixedPoint, MyObjectBuilder_PhysicalObject, bool, bool)
RemoveItemsOfType(MyFixedPoint, MyDefinitionId, MyItemFlags, bool)
ResetVolume()
Serialize(bool)
SetFlags(MyInventoryFlags)
TakeFloatingBag(MyCargoContainerInventoryBagEntity)
TakeFloatingObject(MyFloatingObject)
TransferItemFrom(MyInventory, int, int?, bool?, MyFixedPoint?)
UpdateItem(MyDefinitionId, uint?, float?, float?)
UpdateItemAmoutClient(uint, MyFixedPoint, float)
Add(IMyInventoryItem, MyFixedPoint) Inherited from MyInventoryBase
AddItems(MyFixedPoint, MyObjectBuilder_PhysicalObject, int) Adds item to inventory. Doesn't do all checks inside. Call CanAddItemAmount(IMyInventoryItem, MyFixedPoint) before this function

Inherited from IMyInventory
AddItems(MyFixedPoint, MyObjectBuilder_Base) Adds item to inventory

Inherited from MyInventoryBase
ApplyChanges(List) Inherited from MyInventoryBase
CanAddItemAmount(IMyInventoryItem, MyFixedPoint) Gets whether item could be added into inventory, but doesn't add it Checks: - Inserting volume - Inventory can receive items - Inventory filter can

Inherited from IMyInventory
CanItemsBeAdded(MyFixedPoint, MyItemType) Determines if given amount of items fits into this inventory on top of existing items.

Inherited from IMyInventory
CanTransferItemTo(IMyInventory, MyItemType) Determines if there is working conveyor connection for item of give type to be transferred to other inventory.

Inherited from IMyInventory
Clear(bool) Remove all items from inventory

Inherited from IMyInventory
ComputeAmountThatFits(MyDefinitionId, float, float) Inherited from MyInventoryBase
ConsumeItem(MyDefinitionId, MyFixedPoint, long) Inherited from MyInventoryBase
ContainItems(MyFixedPoint, MyItemType) Determines if there is at least given amount of items of given type contained inside this inventory.

Inherited from IMyInventory
CountItems(Dictionary<MyDefinitionId, MyFixedPoint>) Inherited from MyInventoryBase
Deserialize(MyObjectBuilder_ComponentBase) Inherited from IMyComponentBase
Deserialize(MyObjectBuilder_ComponentBase) Inherited from MyInventoryBase
Deserialize(MyObjectBuilder_ComponentBase) Inherited from MyComponentBase
Empty() Gets if inventory is empty

Inherited from IMyInventory
FindItem(MyItemType) Tries to find an item of given type inside this inventory.

Inherited from IMyInventory
FindItem(SerializableDefinitionId) Finds first item stack, whose content matching provided id

Inherited from IMyInventory
GetAcceptedItems(List, Func<MyItemType, bool>) Returns all items this inventory accepts.

Inherited from IMyInventory
GetAs() Inherited from IMyComponentBase
GetAs() Inherited from MyComponentBase
GetInventoryCount() Returns number of embedded inventories - this inventory can be aggregation of other inventories.

Inherited from MyInventoryBase
GetItemAmount(MyItemType) Sums up total amount of items of given type contained inside this inventory.

Inherited from IMyInventory
GetItemAmount(MyDefinitionId, MyItemFlags, bool) Inherited from MyInventoryBase
GetItemAt(int) Returns info about item at give position.

Inherited from IMyInventory
GetItemByID(uint) Returns info about item contained inside this inventory.

Inherited from IMyInventory
GetItemByID(uint) Gets item by id

Inherited from IMyInventory
GetItems(List, Func<MyInventoryItem, bool>) Collects all items present inside this inventory and returns snapshot of the current inventory state.

Inherited from IMyInventory
GetItems() Inherited from MyInventoryBase
GetItemsCount() Returns the number of items in the inventory. This needs to be overrided, otherwise it returns 0!

Inherited from MyInventoryBase
Init(MyComponentDefinitionBase) Inherited from IMyComponentBase
Init(MyComponentDefinitionBase) Inherited from MyComponentBase
IsConnectedTo(IMyInventory) Checks if two inventories are connected.

Inherited from IMyInventory
IsItemAt(int) Determines if there is any item on given inventory slot.

Inherited from IMyInventory
IsSerialized() Inherited from IMyComponentBase
IsSerialized() Inherited from MyInventoryBase
IsSerialized() Tells the component container serializer whether this component should be saved

Inherited from MyComponentBase
ItemsCanBeAdded(MyFixedPoint, IMyInventoryItem) Inherited from MyInventoryBase
ItemsCanBeRemoved(MyFixedPoint, IMyInventoryItem) Inherited from MyInventoryBase
IterateInventory(int, int) Search for inventory having given search index. Aggregate inventory: Iterates through aggregate inventory until simple inventory with matching index is found. Simple inventory: Returns itself if currentIndex == searchIndex. Usage: searchIndex = index of inventory being searched, leave currentIndex = 0.

Inherited from MyInventoryBase
OnAddedToContainer() Inherited from IMyComponentBase
OnAddedToContainer() Inherited from MyEntityComponentBase
OnAddedToContainer() Gets called after the container of this component changes

Inherited from MyComponentBase
OnAddedToScene() Inherited from IMyComponentBase
OnAddedToScene() CH: TOOD: Be careful! This does not get called if the component is added to a container that is in the scene already!

Inherited from MyComponentBase
OnBeforeContentsChanged() Inherited from MyInventoryBase
OnBeforeRemovedFromContainer() Inherited from IMyComponentBase
OnBeforeRemovedFromContainer() Inherited from MyEntityComponentBase
OnBeforeRemovedFromContainer() Gets called before the removal of this component from a container

Inherited from MyComponentBase
OnContentsAdded(MyPhysicalInventoryItem, MyFixedPoint) Inherited from MyInventoryBase
OnContentsChanged() Inherited from MyInventoryBase
OnContentsRemoved(MyPhysicalInventoryItem, MyFixedPoint) Inherited from MyInventoryBase
OnRemovedFromScene() Inherited from IMyComponentBase
OnRemovedFromScene() CH: TOOD: Be careful! This does not get called if the component is removed from a container that is still in the scene!

Inherited from MyComponentBase
RaiseAfterModifyFinished() Inherited from MyInventoryBase
RaiseBeforeContentsChanged() Inherited from MyInventoryBase
RaiseContentsAdded(MyPhysicalInventoryItem, MyFixedPoint) Inherited from MyInventoryBase
RaiseContentsChanged() Inherited from MyInventoryBase
RaiseContentsRemoved(MyPhysicalInventoryItem, MyFixedPoint) Inherited from MyInventoryBase
RaiseInventoryContentChanged(MyPhysicalInventoryItem, MyFixedPoint) Inherited from MyInventoryBase
Remove(IMyInventoryItem, MyFixedPoint) Inherited from MyInventoryBase
RemoveItemAmount(IMyInventoryItem, MyFixedPoint) Remove

Inherited from IMyInventory
RemoveItems(uint, MyFixedPoint?, bool, bool) Removes item by itemId

Inherited from IMyInventory
RemoveItemsAt(int, MyFixedPoint?, bool, bool) Removes items at exact inventory index

Inherited from IMyInventory
RemoveItemsOfType(MyFixedPoint, MyObjectBuilder_PhysicalObject, bool) Removes amount for specified item type from inventory

Inherited from IMyInventory
RemoveItemsOfType(MyFixedPoint, SerializableDefinitionId, MyItemFlags, bool) Removes amount for specified item type from inventory

Inherited from IMyInventory
RemoveItemsOfType(MyFixedPoint, MyDefinitionId, MyItemFlags, bool) Remove items of a given amount and definition

Inherited from MyInventoryBase
Serialize(bool) Inherited from IMyComponentBase
Serialize(bool) Inherited from MyInventoryBase
Serialize(bool) Inherited from MyComponentBase
SetContainer(IMyComponentContainer) Inherited from IMyComponentBase
SetContainer(IMyComponentContainer) Sets the container of this component. Note that the component is not added to the container here! Therefore, use MyComponentContainer.Add(...) method and it will in turn call this method. Actually, you should seldom have the need to call this method yourself.

Inherited from MyComponentBase
ToString() Inherited from MyInventoryBase
TransferItemFrom(IMyInventory, MyInventoryItem, MyFixedPoint?) Attempts to transfer item from one inventory to another.

Inherited from IMyInventory
TransferItemFrom(IMyInventory, int, int?, bool?, MyFixedPoint?) Attempts to transfer item from one inventory to another.

Inherited from IMyInventory
TransferItemFrom(IMyInventory, int, int?, bool?, MyFixedPoint?, bool) Transfer item from one inventory to another

Inherited from IMyInventory
TransferItemFrom(IMyInventory, IMyInventoryItem, MyFixedPoint) Transfer item from one inventory to another

Inherited from IMyInventory
TransferItemTo(IMyInventory, MyInventoryItem, MyFixedPoint?) Attempts to transfer item from one inventory to another.

Inherited from IMyInventory
TransferItemTo(IMyInventory, int, int?, bool?, MyFixedPoint?) Attempts to transfer item from one inventory to another.

Inherited from IMyInventory
TransferItemTo(IMyInventory, int, int?, bool?, MyFixedPoint?, bool) Transfer item from one inventory to another

Inherited from IMyInventory
GetItems() Obsolete: Use non-allocating GetItems overload

Inherited from IMyInventory

Inheritance: MyComponentBase ˃ MyEntityComponentBase ˃ MyInventoryBase

Implements: