Show / Hide Table of Contents

Class MyInventory

Inheritance
System.Object
MyComponentBase
MyEntityComponentBase
MyInventoryBase
MyInventory
Implements
IMyInventory
IMyInventory
Inherited Members
MyInventoryBase.RemoveEntityOnEmpty
MyInventoryBase.CanPutItems
MyInventoryBase.ToString()
MyInventoryBase.OnOwnerChanged()
MyInventoryBase.IsSerialized()
MyInventoryBase.RaiseContentsChanged()
MyInventoryBase.RaiseInventoryContentChanged(MyPhysicalInventoryItem, MyFixedPoint)
MyInventoryBase.RaiseBeforeContentsChanged()
MyInventoryBase.RaiseContentsAdded(MyPhysicalInventoryItem, MyFixedPoint)
MyInventoryBase.RaiseContentsRemoved(MyPhysicalInventoryItem, MyFixedPoint)
MyInventoryBase.InventoryId
MyInventoryBase.ComponentTypeDebugString
MyInventoryBase.AttachSyncToEntity
MyInventoryBase.ContentsChanged
MyInventoryBase.BeforeContentsChanged
MyInventoryBase.ContentsAdded
MyInventoryBase.ContentsRemoved
MyInventoryBase.InventoryContentChanged
MyInventoryBase.OwnerChanged
MyEntityComponentBase.OnBeforeRemovedFromContainer()
MyEntityComponentBase.Container
MyEntityComponentBase.Entity
MyEntityComponentBase.OnAfterAddedToContainer
MyEntityComponentBase.BeforeRemovedFromContainer
MyComponentBase.SetContainer(IMyComponentContainer)
MyComponentBase.GetAs<T>()
MyComponentBase.OnAddedToScene()
MyComponentBase.OnRemovedFromScene()
MyComponentBase.RemoveExistingComponentOnNewInsert
MyComponentBase.ContainerBase
Namespace: Sandbox.Game
Assembly: Sandbox.Game.dll
Syntax
[MyComponentBuilder]
[StaticEventOwner]
public class MyInventory : MyInventoryBase, IMyEntityComponentBase, IMyComponentBase, IMyEventProxy, IMyEventOwner, IMyInventory, IMyInventory

Constructors

MyInventory()

Declaration
public MyInventory()

MyInventory(Single, Single, Vector3, MyInventoryFlags)

Declaration
public MyInventory(float maxVolume, float maxMass, Vector3 size, MyInventoryFlags flags)
Parameters
Type Name Description
System.Single maxVolume
System.Single maxMass
Vector3 size
MyInventoryFlags flags

MyInventory(Single, Vector3, MyInventoryFlags)

Declaration
public MyInventory(float maxVolume, Vector3 size, MyInventoryFlags flags)
Parameters
Type Name Description
System.Single maxVolume
Vector3 size
MyInventoryFlags flags

MyInventory(MyObjectBuilder_InventoryDefinition, MyInventoryFlags)

Declaration
public MyInventory(MyObjectBuilder_InventoryDefinition definition, MyInventoryFlags flags)
Parameters
Type Name Description
MyObjectBuilder_InventoryDefinition definition
MyInventoryFlags flags

MyInventory(MyFixedPoint, MyFixedPoint, MyInventoryFlags, List<MyPhysicalInventoryItem>)

Declaration
public MyInventory(MyFixedPoint maxVolume, MyFixedPoint maxMass, MyInventoryFlags flags, List<MyPhysicalInventoryItem> initialInventory)
Parameters
Type Name Description
VRage.MyFixedPoint maxVolume
VRage.MyFixedPoint maxMass
MyInventoryFlags flags
System.Collections.Generic.List<MyPhysicalInventoryItem> initialInventory

MyInventory(MyFixedPoint, MyFixedPoint, Vector3, MyInventoryFlags)

Declaration
public MyInventory(MyFixedPoint maxVolume, MyFixedPoint maxMass, Vector3 size, MyInventoryFlags flags)
Parameters
Type Name Description
VRage.MyFixedPoint maxVolume
VRage.MyFixedPoint maxMass
Vector3 size
MyInventoryFlags flags

Fields

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.

Declaration
public MyInventoryConstraint Constraint
Field Value
Type Description
MyInventoryConstraint

ExternalMass

Declaration
public MyFixedPoint ExternalMass
Field Value
Type Description
VRage.MyFixedPoint

INVENTORY_CHANGED

Declaration
public static MyStringHash INVENTORY_CHANGED
Field Value
Type Description
MyStringHash

SyncType

Declaration
public readonly SyncType SyncType
Field Value
Type Description
VRage.Sync.SyncType

UserData

Any attached data..

Declaration
public object UserData
Field Value
Type Description
System.Object

Properties

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

Declaration
public float CargoPercentage { get; }
Property Value
Type Description
System.Single

CurrentMass

Declaration
public override MyFixedPoint CurrentMass { get; }
Property Value
Type Description
VRage.MyFixedPoint
Overrides
MyInventoryBase.CurrentMass

CurrentVolume

Declaration
public override MyFixedPoint CurrentVolume { get; }
Property Value
Type Description
VRage.MyFixedPoint
Overrides
MyInventoryBase.CurrentVolume

ForcedPriority

Declaration
public override Nullable<float> ForcedPriority { get; set; }
Property Value
Type Description
System.Nullable<System.Single>
Overrides
MyInventoryBase.ForcedPriority

InventoryIdx

Declaration
public byte InventoryIdx { get; }
Property Value
Type Description
System.Byte

IsCharacterOwner

Declaration
public bool IsCharacterOwner { get; }
Property Value
Type Description
System.Boolean

IsConstrained

Declaration
public bool IsConstrained { get; }
Property Value
Type Description
System.Boolean

IsFull

Declaration
public bool IsFull { get; }
Property Value
Type Description
System.Boolean

ItemCount

Declaration
public int ItemCount { get; }
Property Value
Type Description
System.Int32

MaxItemCount

Declaration
public override int MaxItemCount { get; }
Property Value
Type Description
System.Int32
Overrides
MyInventoryBase.MaxItemCount

MaxMass

Declaration
public override MyFixedPoint MaxMass { get; }
Property Value
Type Description
VRage.MyFixedPoint
Overrides
MyInventoryBase.MaxMass

MaxVolume

Declaration
public override MyFixedPoint MaxVolume { get; set; }
Property Value
Type Description
VRage.MyFixedPoint
Overrides
MyInventoryBase.MaxVolume

Owner

Declaration
public MyEntity Owner { get; }
Property Value
Type Description
MyEntity

VolumeFillFactor

Declaration
public float VolumeFillFactor { get; }
Property Value
Type Description
System.Single

Methods

Add(IMyInventoryItem, MyFixedPoint)

Declaration
public override bool Add(IMyInventoryItem item, MyFixedPoint amount)
Parameters
Type Name Description
IMyInventoryItem item
VRage.MyFixedPoint amount
Returns
Type Description
System.Boolean
Overrides
MyInventoryBase.Add(IMyInventoryItem, MyFixedPoint)

AddBlocks(MyCubeBlockDefinition, MyFixedPoint)

Declaration
public bool AddBlocks(MyCubeBlockDefinition blockDef, MyFixedPoint amount)
Parameters
Type Name Description
MyCubeBlockDefinition blockDef
VRage.MyFixedPoint amount
Returns
Type Description
System.Boolean

AddItemClient(Int32, MyPhysicalInventoryItem)

Declaration
public void AddItemClient(int position, MyPhysicalInventoryItem item)
Parameters
Type Name Description
System.Int32 position
MyPhysicalInventoryItem item

AddItems(MyFixedPoint, MyObjectBuilder_Base)

Declaration
public override bool AddItems(MyFixedPoint amount, MyObjectBuilder_Base objectBuilder)
Parameters
Type Name Description
VRage.MyFixedPoint amount
MyObjectBuilder_Base objectBuilder
Returns
Type Description
System.Boolean
Overrides
MyInventoryBase.AddItems(MyFixedPoint, MyObjectBuilder_Base)

ApplyChanges(List<MyComponentChange>)

Declaration
public override void ApplyChanges(List<MyComponentChange> changes)
Parameters
Type Name Description
System.Collections.Generic.List<MyComponentChange> changes
Overrides
MyInventoryBase.ApplyChanges(List<MyComponentChange>)

CanItemsBeAdded(MyFixedPoint, MyDefinitionId)

Declaration
public bool CanItemsBeAdded(MyFixedPoint amount, MyDefinitionId contentId)
Parameters
Type Name Description
VRage.MyFixedPoint amount
MyDefinitionId contentId
Returns
Type Description
System.Boolean

CanItemsBeAdded(MyFixedPoint, MyDefinitionId, MyFixedPoint, MyFixedPoint, MyFixedPoint, MyFixedPoint)

Declaration
public bool CanItemsBeAdded(MyFixedPoint amount, MyDefinitionId contentId, MyFixedPoint maxVolume, MyFixedPoint maxMass, MyFixedPoint currentVolume, MyFixedPoint currentMass)
Parameters
Type Name Description
VRage.MyFixedPoint amount
MyDefinitionId contentId
VRage.MyFixedPoint maxVolume
VRage.MyFixedPoint maxMass
VRage.MyFixedPoint currentVolume
VRage.MyFixedPoint currentMass
Returns
Type Description
System.Boolean

ChangeItemClient(MyPhysicalInventoryItem, Int32)

Declaration
public void ChangeItemClient(MyPhysicalInventoryItem item, int position)
Parameters
Type Name Description
MyPhysicalInventoryItem item
System.Int32 position

CheckConstraint(MyDefinitionId)

Declaration
public bool CheckConstraint(MyDefinitionId contentId)
Parameters
Type Name Description
MyDefinitionId contentId
Returns
Type Description
System.Boolean

Clear(Boolean)

Declaration
public void Clear(bool sync = true)
Parameters
Type Name Description
System.Boolean sync

ClearItems()

Declaration
public void ClearItems()

ComputeAmountThatFits(MyBlueprintDefinitionBase)

Declaration
public MyFixedPoint ComputeAmountThatFits(MyBlueprintDefinitionBase blueprint)
Parameters
Type Name Description
MyBlueprintDefinitionBase blueprint
Returns
Type Description
VRage.MyFixedPoint

ComputeAmountThatFits(MyDefinitionId, Single, Single)

Declaration
public override MyFixedPoint ComputeAmountThatFits(MyDefinitionId contentId, float volumeRemoved = 0F, float massRemoved = 0F)
Parameters
Type Name Description
MyDefinitionId contentId
System.Single volumeRemoved
System.Single massRemoved
Returns
Type Description
VRage.MyFixedPoint
Overrides
MyInventoryBase.ComputeAmountThatFits(MyDefinitionId, Single, Single)

ConsumeItem(MyDefinitionId, MyFixedPoint, Int64)

Declaration
public override void ConsumeItem(MyDefinitionId itemId, MyFixedPoint amount, long consumerEntityId = 0L)
Parameters
Type Name Description
MyDefinitionId itemId
VRage.MyFixedPoint amount
System.Int64 consumerEntityId
Overrides
MyInventoryBase.ConsumeItem(MyDefinitionId, MyFixedPoint, Int64)

ContainItems(Nullable<MyFixedPoint>, MyDefinitionId, MyItemFlags)

Declaration
public bool ContainItems(Nullable<MyFixedPoint> amount, MyDefinitionId contentId, MyItemFlags flags)
Parameters
Type Name Description
System.Nullable<VRage.MyFixedPoint> amount
MyDefinitionId contentId
MyItemFlags flags
Returns
Type Description
System.Boolean

ContainItems(MyFixedPoint, MyObjectBuilder_PhysicalObject)

Declaration
public bool ContainItems(MyFixedPoint amount, MyObjectBuilder_PhysicalObject ob)
Parameters
Type Name Description
VRage.MyFixedPoint amount
MyObjectBuilder_PhysicalObject ob
Returns
Type Description
System.Boolean

CountItems(Dictionary<MyDefinitionId, MyFixedPoint>)

Declaration
public override void CountItems(Dictionary<MyDefinitionId, MyFixedPoint> itemCounts)
Parameters
Type Name Description
System.Collections.Generic.Dictionary<MyDefinitionId, VRage.MyFixedPoint> itemCounts
Overrides
MyInventoryBase.CountItems(Dictionary<MyDefinitionId, MyFixedPoint>)

DebugAddItems(MyFixedPoint, MyObjectBuilder_Base)

Declaration
public void DebugAddItems(MyFixedPoint amount, MyObjectBuilder_Base objectBuilder)
Parameters
Type Name Description
VRage.MyFixedPoint amount
MyObjectBuilder_Base objectBuilder

Deserialize(MyObjectBuilder_ComponentBase)

Declaration
public override void Deserialize(MyObjectBuilder_ComponentBase builder)
Parameters
Type Name Description
MyObjectBuilder_ComponentBase builder
Overrides
MyInventoryBase.Deserialize(MyObjectBuilder_ComponentBase)

DropItem(Int32, MyFixedPoint)

Declaration
public void DropItem(int itemIndex, MyFixedPoint amount)
Parameters
Type Name Description
System.Int32 itemIndex
VRage.MyFixedPoint amount

DropItemById(UInt32, MyFixedPoint)

Declaration
public void DropItemById(uint itemId, MyFixedPoint amount)
Parameters
Type Name Description
System.UInt32 itemId
VRage.MyFixedPoint amount

Empty()

Declaration
public bool Empty()
Returns
Type Description
System.Boolean

FilterItemsUsingConstraint()

Declaration
public bool FilterItemsUsingConstraint()
Returns
Type Description
System.Boolean

FindFreeSlotSpace(MyDefinitionId, IMyInventoryItemAdapter)

Declaration
public MyFixedPoint FindFreeSlotSpace(MyDefinitionId contentId, IMyInventoryItemAdapter adapter)
Parameters
Type Name Description
MyDefinitionId contentId
Sandbox.Game.Entities.Interfaces.IMyInventoryItemAdapter adapter
Returns
Type Description
VRage.MyFixedPoint

FindItem(Func<MyPhysicalInventoryItem, Boolean>)

Declaration
public Nullable<MyPhysicalInventoryItem> FindItem(Func<MyPhysicalInventoryItem, bool> predicate)
Parameters
Type Name Description
System.Func<MyPhysicalInventoryItem, System.Boolean> predicate
Returns
Type Description
System.Nullable<MyPhysicalInventoryItem>

FindItem(MyDefinitionId)

Declaration
public Nullable<MyPhysicalInventoryItem> FindItem(MyDefinitionId contentId)
Parameters
Type Name Description
MyDefinitionId contentId
Returns
Type Description
System.Nullable<MyPhysicalInventoryItem>

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

Declaration
public Nullable<MyPhysicalInventoryItem> FindUsableItem(MyDefinitionId contentId)
Parameters
Type Name Description
MyDefinitionId contentId

definition id of the item

Returns
Type Description
System.Nullable<MyPhysicalInventoryItem>

item that has durability > 0 if found

FixInventoryVolume(Single)

Declaration
public void FixInventoryVolume(float newValue)
Parameters
Type Name Description
System.Single newValue

GenerateContent(MyContainerTypeDefinition)

Declaration
public void GenerateContent(MyContainerTypeDefinition containerDefinition)
Parameters
Type Name Description
MyContainerTypeDefinition containerDefinition

GetFlags()

Declaration
public MyInventoryFlags GetFlags()
Returns
Type Description
MyInventoryFlags

GetInventoryCount()

Returns number of embedded inventories - this inventory can be aggregation of other inventories.

Declaration
public override int GetInventoryCount()
Returns
Type Description
System.Int32

Return one for simple inventory, different number when this instance is an aggregation.

Overrides
MyInventoryBase.GetInventoryCount()

GetItemAmount(MyDefinitionId, MyItemFlags, Boolean)

Declaration
public override MyFixedPoint GetItemAmount(MyDefinitionId contentId, MyItemFlags flags, bool substitute = false)
Parameters
Type Name Description
MyDefinitionId contentId
MyItemFlags flags
System.Boolean substitute
Returns
Type Description
VRage.MyFixedPoint
Overrides
MyInventoryBase.GetItemAmount(MyDefinitionId, MyItemFlags, Boolean)

GetItemAt(Int32)

Declaration
public Nullable<MyInventoryItem> GetItemAt(int index)
Parameters
Type Name Description
System.Int32 index
Returns
Type Description
System.Nullable<MyInventoryItem>

GetItemByID(UInt32)

Declaration
public Nullable<MyPhysicalInventoryItem> GetItemByID(uint id)
Parameters
Type Name Description
System.UInt32 id
Returns
Type Description
System.Nullable<MyPhysicalInventoryItem>

GetItemByIndex(Int32)

Declaration
public Nullable<MyPhysicalInventoryItem> GetItemByIndex(int id)
Parameters
Type Name Description
System.Int32 id
Returns
Type Description
System.Nullable<MyPhysicalInventoryItem>

GetItemIndexById(UInt32)

Declaration
public int GetItemIndexById(uint id)
Parameters
Type Name Description
System.UInt32 id
Returns
Type Description
System.Int32

GetItems()

Declaration
public override List<MyPhysicalInventoryItem> GetItems()
Returns
Type Description
System.Collections.Generic.List<MyPhysicalInventoryItem>
Overrides
MyInventoryBase.GetItems()

GetItemsCount()

Declaration
public override int GetItemsCount()
Returns
Type Description
System.Int32
Overrides
MyInventoryBase.GetItemsCount()

GetItemVolumeAndMass(MyDefinitionId, out Single, out Single)

Declaration
public static void GetItemVolumeAndMass(MyDefinitionId contentId, out float itemMass, out float itemVolume)
Parameters
Type Name Description
MyDefinitionId contentId
System.Single itemMass
System.Single itemVolume

GetObjectBuilder()

Declaration
public MyObjectBuilder_Inventory GetObjectBuilder()
Returns
Type Description
MyObjectBuilder_Inventory

Init(MyComponentDefinitionBase)

Declaration
public override void Init(MyComponentDefinitionBase definition)
Parameters
Type Name Description
MyComponentDefinitionBase definition
Overrides
MyComponentBase.Init(MyComponentDefinitionBase)

Init(MyObjectBuilder_Inventory)

Declaration
public void Init(MyObjectBuilder_Inventory objectBuilder)
Parameters
Type Name Description
MyObjectBuilder_Inventory objectBuilder

IsItemAt(Int32)

Declaration
public bool IsItemAt(int position)
Parameters
Type Name Description
System.Int32 position
Returns
Type Description
System.Boolean

IsUniqueId(UInt32)

Declaration
public bool IsUniqueId(uint idToTest)
Parameters
Type Name Description
System.UInt32 idToTest
Returns
Type Description
System.Boolean

ItemsCanBeAdded(MyFixedPoint, IMyInventoryItem)

Declaration
public override bool ItemsCanBeAdded(MyFixedPoint amount, IMyInventoryItem item)
Parameters
Type Name Description
VRage.MyFixedPoint amount
IMyInventoryItem item
Returns
Type Description
System.Boolean
Overrides
MyInventoryBase.ItemsCanBeAdded(MyFixedPoint, IMyInventoryItem)

ItemsCanBeRemoved(MyFixedPoint, IMyInventoryItem)

Declaration
public override bool ItemsCanBeRemoved(MyFixedPoint amount, IMyInventoryItem item)
Parameters
Type Name Description
VRage.MyFixedPoint amount
IMyInventoryItem item
Returns
Type Description
System.Boolean
Overrides
MyInventoryBase.ItemsCanBeRemoved(MyFixedPoint, IMyInventoryItem)

IterateInventory(Int32, Int32)

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.

Declaration
public override MyInventoryBase IterateInventory(int searchIndex, int currentIndex = 0)
Parameters
Type Name Description
System.Int32 searchIndex
System.Int32 currentIndex
Returns
Type Description
MyInventoryBase
Overrides
MyInventoryBase.IterateInventory(Int32, Int32)

ModifyContent(MyPhysicalInventoryItem, Action<MyObjectBuilder_PhysicalObject>)

Declaration
public void ModifyContent(MyPhysicalInventoryItem item, Action<MyObjectBuilder_PhysicalObject> action)
Parameters
Type Name Description
MyPhysicalInventoryItem item
System.Action<MyObjectBuilder_PhysicalObject> action

ModifyDatapad(Int32, UInt32, String, String)

Declaration
[Event(null, 2094)]
[Reliable]
[Server]
public void ModifyDatapad(int inventoryIndex, uint itemId, string name, string data)
Parameters
Type Name Description
System.Int32 inventoryIndex
System.UInt32 itemId
System.String name
System.String data

OnAddedToContainer()

Declaration
public override void OnAddedToContainer()
Overrides
MyEntityComponentBase.OnAddedToContainer()

OnBeforeContentsChanged()

Declaration
public override void OnBeforeContentsChanged()
Overrides
MyInventoryBase.OnBeforeContentsChanged()

OnContentsAdded(MyPhysicalInventoryItem, MyFixedPoint)

Declaration
public override void OnContentsAdded(MyPhysicalInventoryItem item, MyFixedPoint amount)
Parameters
Type Name Description
MyPhysicalInventoryItem item
VRage.MyFixedPoint amount
Overrides
MyInventoryBase.OnContentsAdded(MyPhysicalInventoryItem, MyFixedPoint)

OnContentsChanged()

Declaration
public override void OnContentsChanged()
Overrides
MyInventoryBase.OnContentsChanged()

OnContentsRemoved(MyPhysicalInventoryItem, MyFixedPoint)

Declaration
public override void OnContentsRemoved(MyPhysicalInventoryItem item, MyFixedPoint amount)
Parameters
Type Name Description
MyPhysicalInventoryItem item
VRage.MyFixedPoint amount
Overrides
MyInventoryBase.OnContentsRemoved(MyPhysicalInventoryItem, MyFixedPoint)

PickupItem(MyFloatingObject, MyFixedPoint)

Declaration
public void PickupItem(MyFloatingObject obj, MyFixedPoint amount)
Parameters
Type Name Description
MyFloatingObject obj
VRage.MyFixedPoint amount

Refresh()

Declaration
public void Refresh()

Remove(IMyInventoryItem, MyFixedPoint)

Declaration
public override bool Remove(IMyInventoryItem item, MyFixedPoint amount)
Parameters
Type Name Description
IMyInventoryItem item
VRage.MyFixedPoint amount
Returns
Type Description
System.Boolean
Overrides
MyInventoryBase.Remove(IMyInventoryItem, MyFixedPoint)

RemoveItemClient(UInt32)

Declaration
public void RemoveItemClient(uint itemId)
Parameters
Type Name Description
System.UInt32 itemId

RemoveItems(UInt32, Nullable<MyFixedPoint>, Boolean, Boolean, Nullable<MatrixD>, Action<MyDefinitionId, MyEntity>, Boolean)

Declaration
public void RemoveItems(uint itemId, Nullable<MyFixedPoint> amount = null, bool sendEvent = true, bool spawn = false, Nullable<MatrixD> spawnPos = null, Action<MyDefinitionId, MyEntity> itemSpawned = null, bool refreshVolumeAndMass = true)
Parameters
Type Name Description
System.UInt32 itemId
System.Nullable<VRage.MyFixedPoint> amount
System.Boolean sendEvent
System.Boolean spawn
System.Nullable<MatrixD> spawnPos
System.Action<MyDefinitionId, MyEntity> itemSpawned
System.Boolean refreshVolumeAndMass

RemoveItemsAt(Int32, Nullable<MyFixedPoint>, Boolean, Boolean, Boolean)

Declaration
public void RemoveItemsAt(int itemIndex, Nullable<MyFixedPoint> amount = null, bool sendEvent = true, bool spawn = false, bool refreshVolumeAndMass = true)
Parameters
Type Name Description
System.Int32 itemIndex
System.Nullable<VRage.MyFixedPoint> amount
System.Boolean sendEvent
System.Boolean spawn
System.Boolean refreshVolumeAndMass

RemoveItemsOfType(MyFixedPoint, MyDefinitionId, MyItemFlags, Boolean)

Declaration
public override MyFixedPoint RemoveItemsOfType(MyFixedPoint amount, MyDefinitionId contentId, MyItemFlags flags, bool spawn = false)
Parameters
Type Name Description
VRage.MyFixedPoint amount
MyDefinitionId contentId
MyItemFlags flags
System.Boolean spawn
Returns
Type Description
VRage.MyFixedPoint
Overrides
MyInventoryBase.RemoveItemsOfType(MyFixedPoint, MyDefinitionId, MyItemFlags, Boolean)

RemoveItemsOfType(MyFixedPoint, MyObjectBuilder_PhysicalObject, Boolean, Boolean)

Declaration
public bool RemoveItemsOfType(MyFixedPoint amount, MyObjectBuilder_PhysicalObject objectBuilder, bool spawn = false, bool onlyWhole = true)
Parameters
Type Name Description
VRage.MyFixedPoint amount
MyObjectBuilder_PhysicalObject objectBuilder
System.Boolean spawn
System.Boolean onlyWhole
Returns
Type Description
System.Boolean

ResetVolume()

Declaration
public void ResetVolume()

Serialize(Boolean)

Declaration
public override MyObjectBuilder_ComponentBase Serialize(bool copy = false)
Parameters
Type Name Description
System.Boolean copy
Returns
Type Description
MyObjectBuilder_ComponentBase
Overrides
MyInventoryBase.Serialize(Boolean)

SetFlags(MyInventoryFlags)

Declaration
public void SetFlags(MyInventoryFlags flags)
Parameters
Type Name Description
MyInventoryFlags flags

ShowCantConsume()

Declaration
[Event(null, 2405)]
[Reliable]
[Client]
public static void ShowCantConsume()

TakeFloatingBag(MyCargoContainerInventoryBagEntity)

Declaration
public void TakeFloatingBag(MyCargoContainerInventoryBagEntity obj)
Parameters
Type Name Description
MyCargoContainerInventoryBagEntity obj

TakeFloatingObject(MyFloatingObject)

Declaration
public void TakeFloatingObject(MyFloatingObject obj)
Parameters
Type Name Description
MyFloatingObject obj

Transfer(MyInventory, MyInventory, UInt32, Int32, Nullable<MyFixedPoint>, Boolean)

Declaration
public static MyFixedPoint Transfer(MyInventory src, MyInventory dst, uint srcItemId, int dstIdx = -1, Nullable<MyFixedPoint> amount = null, bool spawn = false)
Parameters
Type Name Description
MyInventory src
MyInventory dst
System.UInt32 srcItemId
System.Int32 dstIdx
System.Nullable<VRage.MyFixedPoint> amount
System.Boolean spawn
Returns
Type Description
VRage.MyFixedPoint

Transfer(MyInventory, MyInventory, MyDefinitionId, MyItemFlags, Nullable<MyFixedPoint>, Boolean)

Declaration
public static MyFixedPoint Transfer(MyInventory src, MyInventory dst, MyDefinitionId contentId, MyItemFlags flags, Nullable<MyFixedPoint> amount = null, bool spawn = false)
Parameters
Type Name Description
MyInventory src
MyInventory dst
MyDefinitionId contentId
MyItemFlags flags
System.Nullable<VRage.MyFixedPoint> amount
System.Boolean spawn
Returns
Type Description
VRage.MyFixedPoint

TransferAll(MyInventory, MyInventory)

Declaration
public static void TransferAll(MyInventory src, MyInventory dst)
Parameters
Type Name Description
MyInventory src
MyInventory dst

TransferByPlanner(MyInventory, MyInventory, SerializableDefinitionId, MyItemFlags, Nullable<MyFixedPoint>, Boolean)

Declaration
public static void TransferByPlanner(MyInventory src, MyInventory dst, SerializableDefinitionId contentId, MyItemFlags flags, Nullable<MyFixedPoint> amount = null, bool spawn = false)
Parameters
Type Name Description
MyInventory src
MyInventory dst
SerializableDefinitionId contentId
MyItemFlags flags
System.Nullable<VRage.MyFixedPoint> amount
System.Boolean spawn

TransferByUser(MyInventory, MyInventory, UInt32, Int32, Nullable<MyFixedPoint>)

Declaration
public static void TransferByUser(MyInventory src, MyInventory dst, uint srcItemId, int dstIdx = -1, Nullable<MyFixedPoint> amount = null)
Parameters
Type Name Description
MyInventory src
MyInventory dst
System.UInt32 srcItemId
System.Int32 dstIdx
System.Nullable<VRage.MyFixedPoint> amount

TransferItemFrom(MyInventory, Int32, Nullable<Int32>, Nullable<Boolean>, Nullable<MyFixedPoint>)

Declaration
public void TransferItemFrom(MyInventory sourceInventory, int sourceItemIndex, Nullable<int> targetItemIndex = null, Nullable<bool> stackIfPossible = null, Nullable<MyFixedPoint> amount = null)
Parameters
Type Name Description
MyInventory sourceInventory
System.Int32 sourceItemIndex
System.Nullable<System.Int32> targetItemIndex
System.Nullable<System.Boolean> stackIfPossible
System.Nullable<VRage.MyFixedPoint> amount

UpdateItem(MyDefinitionId, Nullable<UInt32>, Nullable<Single>, Nullable<Single>)

Declaration
public void UpdateItem(MyDefinitionId contentId, Nullable<uint> itemId = null, Nullable<float> amount = null, Nullable<float> itemHP = null)
Parameters
Type Name Description
MyDefinitionId contentId
System.Nullable<System.UInt32> itemId
System.Nullable<System.Single> amount
System.Nullable<System.Single> itemHP

UpdateItemAmoutClient(UInt32, MyFixedPoint, Single)

Declaration
public void UpdateItemAmoutClient(uint itemId, MyFixedPoint amount, float gasAmount)
Parameters
Type Name Description
System.UInt32 itemId
VRage.MyFixedPoint amount
System.Single gasAmount

Events

OnTransferByUser

Declaration
public static event Action<IMyInventory, IMyInventory, IMyInventoryItem, MyFixedPoint> OnTransferByUser
Event Type
Type Description
System.Action<IMyInventory, IMyInventory, IMyInventoryItem, VRage.MyFixedPoint>

OnVolumeChanged

Declaration
public event Action<IMyInventory, float, float> OnVolumeChanged
Event Type
Type Description
System.Action<IMyInventory, System.Single, System.Single>

Explicit Interface Implementations

IMyInventory.AddItems(MyFixedPoint, MyObjectBuilder_PhysicalObject, Int32)

Declaration
void IMyInventory.AddItems(MyFixedPoint amount, MyObjectBuilder_PhysicalObject objectBuilder, int index)
Parameters
Type Name Description
VRage.MyFixedPoint amount
MyObjectBuilder_PhysicalObject objectBuilder
System.Int32 index

IMyInventory.CanAddItemAmount(IMyInventoryItem, MyFixedPoint)

Declaration
bool IMyInventory.CanAddItemAmount(IMyInventoryItem item, MyFixedPoint amount)
Parameters
Type Name Description
IMyInventoryItem item
VRage.MyFixedPoint amount
Returns
Type Description
System.Boolean

IMyInventory.CanPutItems

Declaration
bool IMyInventory.CanPutItems { get; set; }
Returns
Type Description
System.Boolean

IMyInventory.FindItem(SerializableDefinitionId)

Declaration
IMyInventoryItem IMyInventory.FindItem(SerializableDefinitionId contentId)
Parameters
Type Name Description
SerializableDefinitionId contentId
Returns
Type Description
IMyInventoryItem

IMyInventory.GetItemByID(UInt32)

Declaration
IMyInventoryItem IMyInventory.GetItemByID(uint id)
Parameters
Type Name Description
System.UInt32 id
Returns
Type Description
IMyInventoryItem

IMyInventory.GetItems()

Declaration
List<IMyInventoryItem> IMyInventory.GetItems()
Returns
Type Description
System.Collections.Generic.List<IMyInventoryItem>

IMyInventory.Owner

Declaration
IMyEntity IMyInventory.Owner { get; }
Returns
Type Description
IMyEntity

IMyInventory.RemoveItemAmount(IMyInventoryItem, MyFixedPoint)

Declaration
void IMyInventory.RemoveItemAmount(IMyInventoryItem item, MyFixedPoint amount)
Parameters
Type Name Description
IMyInventoryItem item
VRage.MyFixedPoint amount

IMyInventory.RemoveItems(UInt32, Nullable<MyFixedPoint>, Boolean, Boolean)

Declaration
void IMyInventory.RemoveItems(uint itemId, Nullable<MyFixedPoint> amount, bool sendEvent, bool spawn)
Parameters
Type Name Description
System.UInt32 itemId
System.Nullable<VRage.MyFixedPoint> amount
System.Boolean sendEvent
System.Boolean spawn

IMyInventory.RemoveItemsAt(Int32, Nullable<MyFixedPoint>, Boolean, Boolean)

Declaration
void IMyInventory.RemoveItemsAt(int itemIndex, Nullable<MyFixedPoint> amount, bool sendEvent, bool spawn)
Parameters
Type Name Description
System.Int32 itemIndex
System.Nullable<VRage.MyFixedPoint> amount
System.Boolean sendEvent
System.Boolean spawn

IMyInventory.RemoveItemsOfType(MyFixedPoint, MyObjectBuilder_PhysicalObject, Boolean)

Declaration
void IMyInventory.RemoveItemsOfType(MyFixedPoint amount, MyObjectBuilder_PhysicalObject objectBuilder, bool spawn)
Parameters
Type Name Description
VRage.MyFixedPoint amount
MyObjectBuilder_PhysicalObject objectBuilder
System.Boolean spawn

IMyInventory.RemoveItemsOfType(MyFixedPoint, SerializableDefinitionId, MyItemFlags, Boolean)

Declaration
void IMyInventory.RemoveItemsOfType(MyFixedPoint amount, SerializableDefinitionId contentId, MyItemFlags flags, bool spawn)
Parameters
Type Name Description
VRage.MyFixedPoint amount
SerializableDefinitionId contentId
MyItemFlags flags
System.Boolean spawn

IMyInventory.TransferItemFrom(IMyInventory, Int32, Nullable<Int32>, Nullable<Boolean>, Nullable<MyFixedPoint>, Boolean)

Declaration
bool IMyInventory.TransferItemFrom(IMyInventory sourceInventory, int sourceItemIndex, Nullable<int> targetItemIndex, Nullable<bool> stackIfPossible, Nullable<MyFixedPoint> amount, bool checkConnection)
Parameters
Type Name Description
IMyInventory sourceInventory
System.Int32 sourceItemIndex
System.Nullable<System.Int32> targetItemIndex
System.Nullable<System.Boolean> stackIfPossible
System.Nullable<VRage.MyFixedPoint> amount
System.Boolean checkConnection
Returns
Type Description
System.Boolean

IMyInventory.TransferItemFrom(IMyInventory, IMyInventoryItem, MyFixedPoint)

Declaration
bool IMyInventory.TransferItemFrom(IMyInventory sourceInventory, IMyInventoryItem item, MyFixedPoint amount)
Parameters
Type Name Description
IMyInventory sourceInventory
IMyInventoryItem item
VRage.MyFixedPoint amount
Returns
Type Description
System.Boolean

IMyInventory.TransferItemTo(IMyInventory, Int32, Nullable<Int32>, Nullable<Boolean>, Nullable<MyFixedPoint>, Boolean)

Declaration
bool IMyInventory.TransferItemTo(IMyInventory dst, int sourceItemIndex, Nullable<int> targetItemIndex, Nullable<bool> stackIfPossible, Nullable<MyFixedPoint> amount, bool checkConnection)
Parameters
Type Name Description
IMyInventory dst
System.Int32 sourceItemIndex
System.Nullable<System.Int32> targetItemIndex
System.Nullable<System.Boolean> stackIfPossible
System.Nullable<VRage.MyFixedPoint> amount
System.Boolean checkConnection
Returns
Type Description
System.Boolean

IMyInventory.CanItemsBeAdded(MyFixedPoint, MyItemType)

Declaration
bool IMyInventory.CanItemsBeAdded(MyFixedPoint amount, MyItemType itemType)
Parameters
Type Name Description
VRage.MyFixedPoint amount
MyItemType itemType
Returns
Type Description
System.Boolean

IMyInventory.CanPutItems

Declaration
bool IMyInventory.CanPutItems { get; }
Returns
Type Description
System.Boolean

IMyInventory.CanTransferItemTo(IMyInventory, MyItemType)

Declaration
bool IMyInventory.CanTransferItemTo(IMyInventory dst, MyItemType itemType)
Parameters
Type Name Description
IMyInventory dst
MyItemType itemType
Returns
Type Description
System.Boolean

IMyInventory.ContainItems(MyFixedPoint, MyItemType)

Declaration
bool IMyInventory.ContainItems(MyFixedPoint amount, MyItemType itemType)
Parameters
Type Name Description
VRage.MyFixedPoint amount
MyItemType itemType
Returns
Type Description
System.Boolean

IMyInventory.FindItem(MyItemType)

Declaration
Nullable<MyInventoryItem> IMyInventory.FindItem(MyItemType itemType)
Parameters
Type Name Description
MyItemType itemType
Returns
Type Description
System.Nullable<MyInventoryItem>

IMyInventory.GetAcceptedItems(List<MyItemType>, Func<MyItemType, Boolean>)

Declaration
void IMyInventory.GetAcceptedItems(List<MyItemType> items, Func<MyItemType, bool> filter)
Parameters
Type Name Description
System.Collections.Generic.List<MyItemType> items
System.Func<MyItemType, System.Boolean> filter

IMyInventory.GetItemAmount(MyItemType)

Declaration
MyFixedPoint IMyInventory.GetItemAmount(MyItemType contentId)
Parameters
Type Name Description
MyItemType contentId
Returns
Type Description
VRage.MyFixedPoint

IMyInventory.GetItemByID(UInt32)

Declaration
Nullable<MyInventoryItem> IMyInventory.GetItemByID(uint id)
Parameters
Type Name Description
System.UInt32 id
Returns
Type Description
System.Nullable<MyInventoryItem>

IMyInventory.GetItems(List<MyInventoryItem>, Func<MyInventoryItem, Boolean>)

Declaration
void IMyInventory.GetItems(List<MyInventoryItem> items, Func<MyInventoryItem, bool> filter)
Parameters
Type Name Description
System.Collections.Generic.List<MyInventoryItem> items
System.Func<MyInventoryItem, System.Boolean> filter

IMyInventory.IsConnectedTo(IMyInventory)

Declaration
bool IMyInventory.IsConnectedTo(IMyInventory dst)
Parameters
Type Name Description
IMyInventory dst
Returns
Type Description
System.Boolean

IMyInventory.Owner

Declaration
IMyEntity IMyInventory.Owner { get; }
Returns
Type Description
IMyEntity

IMyInventory.TransferItemFrom(IMyInventory, Int32, Nullable<Int32>, Nullable<Boolean>, Nullable<MyFixedPoint>)

Declaration
bool IMyInventory.TransferItemFrom(IMyInventory sourceInventory, int sourceItemIndex, Nullable<int> targetItemIndex, Nullable<bool> stackIfPossible, Nullable<MyFixedPoint> amount)
Parameters
Type Name Description
IMyInventory sourceInventory
System.Int32 sourceItemIndex
System.Nullable<System.Int32> targetItemIndex
System.Nullable<System.Boolean> stackIfPossible
System.Nullable<VRage.MyFixedPoint> amount
Returns
Type Description
System.Boolean

IMyInventory.TransferItemFrom(IMyInventory, MyInventoryItem, Nullable<MyFixedPoint>)

Declaration
bool IMyInventory.TransferItemFrom(IMyInventory sourceInventory, MyInventoryItem item, Nullable<MyFixedPoint> amount)
Parameters
Type Name Description
IMyInventory sourceInventory
MyInventoryItem item
System.Nullable<VRage.MyFixedPoint> amount
Returns
Type Description
System.Boolean

IMyInventory.TransferItemTo(IMyInventory, Int32, Nullable<Int32>, Nullable<Boolean>, Nullable<MyFixedPoint>)

Declaration
bool IMyInventory.TransferItemTo(IMyInventory dst, int sourceItemIndex, Nullable<int> targetItemIndex, Nullable<bool> stackIfPossible, Nullable<MyFixedPoint> amount)
Parameters
Type Name Description
IMyInventory dst
System.Int32 sourceItemIndex
System.Nullable<System.Int32> targetItemIndex
System.Nullable<System.Boolean> stackIfPossible
System.Nullable<VRage.MyFixedPoint> amount
Returns
Type Description
System.Boolean

IMyInventory.TransferItemTo(IMyInventory, MyInventoryItem, Nullable<MyFixedPoint>)

Declaration
bool IMyInventory.TransferItemTo(IMyInventory dstInventory, MyInventoryItem item, Nullable<MyFixedPoint> amount)
Parameters
Type Name Description
IMyInventory dstInventory
MyInventoryItem item
System.Nullable<VRage.MyFixedPoint> amount
Returns
Type Description
System.Boolean

Implements

IMyInventory
IMyInventory

Extension Methods

MyEntityContainerEventExtensions.RegisterForEntityEvent(MyEntityComponentBase, MyStringHash, MyEntityContainerEventExtensions.EntityEventHandler)
MyEntityContainerEventExtensions.RegisterForEntityEvent(MyEntityComponentBase, MyEntity, MyStringHash, MyEntityContainerEventExtensions.EntityEventHandler)
MyEntityContainerEventExtensions.UnregisterForEntityEvent(MyEntityComponentBase, MyEntity, MyStringHash)
MyEntityContainerEventExtensions.RaiseEntityEvent(MyEntityComponentBase, MyStringHash, MyEntityContainerEventExtensions.EntityEventParams)
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾