Space Engineers
|
Public Member Functions | |
MyInventoryBase (string inventoryId) | |
override void | Deserialize (MyObjectBuilder_ComponentBase builder) |
override MyObjectBuilder_ComponentBase | Serialize (bool copy=false) |
override string | ToString () |
abstract MyFixedPoint | ComputeAmountThatFits (MyDefinitionId contentId, float volumeRemoved=0, float massRemoved=0) |
abstract MyFixedPoint | GetItemAmount (MyDefinitionId contentId, MyItemFlags flags=MyItemFlags.None, bool substitute=false) |
abstract bool | ItemsCanBeAdded (MyFixedPoint amount, IMyInventoryItem item) |
abstract bool | ItemsCanBeRemoved (MyFixedPoint amount, IMyInventoryItem item) |
abstract bool | Add (IMyInventoryItem item, MyFixedPoint amount) |
abstract bool | Remove (IMyInventoryItem item, MyFixedPoint amount) |
abstract void | CountItems (Dictionary< MyDefinitionId, MyFixedPoint > itemCounts) |
abstract void | ApplyChanges (List< MyComponentChange > changes) |
abstract List< MyPhysicalInventoryItem > | GetItems () |
abstract bool | AddItems (MyFixedPoint amount, MyObjectBuilder_Base objectBuilder) |
Adds item to inventory More... | |
abstract MyFixedPoint | RemoveItemsOfType (MyFixedPoint amount, MyDefinitionId contentId, MyItemFlags flags=MyItemFlags.None, bool spawn=false) |
Remove items of a given amount and definition More... | |
abstract bool | TransferItemsFrom (MyInventoryBase sourceInventory, IMyInventoryItem item, MyFixedPoint amount) |
Transfers safely given item from inventory given as parameter to this instance. More... | |
abstract void | OnContentsChanged () |
abstract void | OnBeforeContentsChanged () |
virtual int | GetItemsCount () |
Returns the number of items in the inventory. This needs to be overrided, otherwise it returns 0! More... | |
abstract int | GetInventoryCount () |
Returns number of embedded inventories - this inventory can be aggregation of other inventories. More... | |
abstract MyInventoryBase | IterateInventory (int searchIndex, int currentIndex=0) |
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. More... | |
override bool | IsSerialized () |
Tells the component container serializer whether this component should be saved More... | |
abstract void | ConsumeItem (MyDefinitionId itemId, MyFixedPoint amount, long consumerEntityId=0) |
void | RaiseContentsChanged () |
void | RaiseBeforeContentsChanged () |
![]() | |
override void | OnAddedToContainer () |
Gets called after the container of this component changes More... | |
override void | OnBeforeRemovedFromContainer () |
Gets called before the removal of this component from a container More... | |
![]() | |
virtual void | SetContainer (MyComponentContainer container) |
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. More... | |
virtual T | GetAs< T > () |
virtual void | OnAddedToScene () |
CH: TOOD: Be careful! This does not get called if the component is added to a container that is in the scene already! More... | |
virtual void | OnRemovedFromScene () |
CH: TOOD: Be careful! This does not get called if the component is removed from a container that is still in the scene! More... | |
virtual void | Init (MyComponentDefinitionBase definition) |
Public Attributes | |
bool | RemoveEntityOnEmpty = false |
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. More... | |
Protected Member Functions | |
void | OnOwnerChanged () |
Properties | |
MyStringHash | InventoryId [get] |
This is for the purpose of identifying the inventory in aggregates (i.e. "Backpack", "LeftHand", ...) More... | |
abstract MyFixedPoint | CurrentMass [get] |
abstract MyFixedPoint | MaxMass [get] |
abstract int | MaxItemCount [get] |
abstract MyFixedPoint | CurrentVolume [get] |
abstract MyFixedPoint | MaxVolume [get] |
abstract float | ForcedPriority [get, set] |
override string | ComponentTypeDebugString [get] |
![]() | |
MyEntityComponentContainer | Container [get] |
IMyEntity | Entity [get] |
abstract string | ComponentTypeDebugString [get] |
Name of the base component type for debug purposes (e.g.: "Position") More... | |
![]() | |
MyComponentContainer | ContainerBase [get] |
This cannot be named Container to not conflict with the definition of Container in MyEntityComponentBase. More... | |
Events | |
Action< MyInventoryBase > | ContentsChanged |
Called when items were added or removed, or their amount has changed More... | |
Action< MyInventoryBase > | BeforeContentsChanged |
Action< MyInventoryBase, MyComponentContainer > | OwnerChanged |
Called if this inventory changed its owner More... | |
![]() | |
static Action< MyEntityComponentBase > | OnAfterAddedToContainer |
Action< MyEntityComponentBase > | BeforeRemovedFromContainer |
Definition at line 15 of file MyInventoryBase.cs.
|
inline |
Definition at line 49 of file MyInventoryBase.cs.
|
pure virtual |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
pure virtual |
Adds item to inventory
amount | |
objectBuilder | |
index |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
pure virtual |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
pure virtual |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
pure virtual |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
pure virtual |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
inlinevirtual |
Reimplemented from VRage.Game.Components.MyComponentBase.
Definition at line 54 of file MyInventoryBase.cs.
|
pure virtual |
Returns number of embedded inventories - this inventory can be aggregation of other inventories.
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
pure virtual |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
pure virtual |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
inlinevirtual |
Returns the number of items in the inventory. This needs to be overrided, otherwise it returns 0!
Reimplemented in Sandbox.Game.MyInventory.
Definition at line 121 of file MyInventoryBase.cs.
|
inlinevirtual |
Tells the component container serializer whether this component should be saved
Reimplemented from VRage.Game.Components.MyComponentBase.
Definition at line 148 of file MyInventoryBase.cs.
|
pure virtual |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
pure virtual |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
pure virtual |
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.
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
pure virtual |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
pure virtual |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
inlineprotected |
Definition at line 141 of file MyInventoryBase.cs.
|
inline |
Definition at line 161 of file MyInventoryBase.cs.
|
inline |
Definition at line 155 of file MyInventoryBase.cs.
|
pure virtual |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
pure virtual |
Remove items of a given amount and definition
amount | amount ot remove |
contentId | definition id of items to be removed |
spawn | Set tru to spawn object in the world, after it was removed |
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
|
inlinevirtual |
Reimplemented from VRage.Game.Components.MyComponentBase.
Definition at line 62 of file MyInventoryBase.cs.
|
inline |
Definition at line 70 of file MyInventoryBase.cs.
|
pure virtual |
Transfers safely given item from inventory given as parameter to this instance.
Implemented in Sandbox.Game.MyInventory, and Sandbox.Game.Entities.Inventory.MyInventoryAggregate.
bool VRage.Game.Entity.MyInventoryBase.RemoveEntityOnEmpty = false |
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.
Definition at line 21 of file MyInventoryBase.cs.
|
get |
Definition at line 36 of file MyInventoryBase.cs.
|
get |
Definition at line 28 of file MyInventoryBase.cs.
|
get |
Definition at line 32 of file MyInventoryBase.cs.
|
getset |
Definition at line 35 of file MyInventoryBase.cs.
|
get |
This is for the purpose of identifying the inventory in aggregates (i.e. "Backpack", "LeftHand", ...)
Definition at line 26 of file MyInventoryBase.cs.
|
get |
Definition at line 30 of file MyInventoryBase.cs.
|
get |
Definition at line 29 of file MyInventoryBase.cs.
|
get |
Definition at line 33 of file MyInventoryBase.cs.
Action<MyInventoryBase> VRage.Game.Entity.MyInventoryBase.BeforeContentsChanged |
Definition at line 42 of file MyInventoryBase.cs.
Action<MyInventoryBase> VRage.Game.Entity.MyInventoryBase.ContentsChanged |
Called when items were added or removed, or their amount has changed
Definition at line 41 of file MyInventoryBase.cs.
Action<MyInventoryBase, MyComponentContainer> VRage.Game.Entity.MyInventoryBase.OwnerChanged |
Called if this inventory changed its owner
Definition at line 47 of file MyInventoryBase.cs.