Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

VRage.Game.ModAPI.Ingame.IMyInventory

Malware edited this page Oct 22, 2024 · 49 revisions

IndexNamespace Index

IMyInventory Interface

public interface IMyInventory

Describes inventory interface (PB scripting interface)

Namespace: VRage.Game.ModAPI.Ingame
Assembly: VRage.Game.dll

Properties

bool CanPutItems { get; }

Gets if inventory can receive items or not.

MyFixedPoint CurrentMass { get; }

Returns total mass of items inside this inventory in Kg.

MyFixedPoint CurrentVolume { get; }

Returns total volume of items inside this inventory in m^3.

bool IsFull { get; }

Determines if inventory is absolutely full.

int ItemCount { get; }

Returns number of occupied inventory slots.

MyFixedPoint MaxVolume { get; }

Sets maximum volume of items this inventory can contain in m^3.

IMyEntity Owner { get; }

Returns entity this inventory belongs to.

float VolumeFillFactor { get; }

Gets the current volume fill factor of the inventory

Methods

bool CanItemsBeAdded(MyFixedPoint amount, MyItemType itemType)

Determines if given amount of items fits into this inventory on top of existing items.

bool CanTransferItemTo(IMyInventory otherInventory, MyItemType itemType)

Determines if there is working conveyor connection for item of give type to be transferred to other inventory.

bool ContainItems(MyFixedPoint amount, MyItemType itemType)

Determines if there is at least given amount of items of given type contained inside this inventory.

MyInventoryItem? FindItem(MyItemType itemType)

Tries to find an item of given type inside this inventory.

void GetAcceptedItems(List<MyItemType> itemsTypes, Func<MyItemType, bool> filter = null)

Returns all items this inventory accepts.

MyFixedPoint GetItemAmount(MyItemType itemType)

Sums up total amount of items of given type contained inside this inventory.

MyInventoryItem? GetItemAt(int index)

Returns info about item at give position.

MyInventoryItem? GetItemByID(uint id)

Returns info about item contained inside this inventory.

void GetItems(List<MyInventoryItem> items, Func<MyInventoryItem, bool> filter = null)

Collects all items present inside this inventory and returns snapshot of the current inventory state.

bool IsConnectedTo(IMyInventory otherInventory)

Checks if two inventories are connected.

bool IsItemAt(int position)

Determines if there is any item on given inventory slot.

bool TransferItemFrom(IMyInventory sourceInventory, MyInventoryItem item, MyFixedPoint? amount = default)

Attempts to transfer item from one inventory to another.

bool TransferItemFrom(IMyInventory sourceInventory, int sourceItemIndex, int? targetItemIndex = default, bool? stackIfPossible = default, MyFixedPoint? amount = default)

Attempts to transfer item from one inventory to another.

bool TransferItemTo(IMyInventory dstInventory, MyInventoryItem item, MyFixedPoint? amount = default)

Attempts to transfer item from one inventory to another.

bool TransferItemTo(IMyInventory dst, int sourceItemIndex, int? targetItemIndex = default, bool? stackIfPossible = default, MyFixedPoint? amount = default)

Attempts to transfer item from one inventory to another.

Clone this wiki locally