Space Engineers
|
This class implements basic functionality for the interface IMyInventoryAggregate. Use it as base class only if the basic functionality is enough. More...
Public Member Functions | |
MyInventoryAggregate () | |
MyInventoryAggregate (string inventoryId) | |
void | Init () |
void | DetachCallbacks () |
override MyFixedPoint | ComputeAmountThatFits (MyDefinitionId contentId, float volumeRemoved=0, float massRemoved=0) |
override MyFixedPoint | GetItemAmount (MyDefinitionId contentId, MyItemFlags flags=MyItemFlags.None, bool substitute=false) |
override bool | AddItems (MyFixedPoint amount, MyObjectBuilder_Base objectBuilder) |
Adds item to inventory More... | |
override MyFixedPoint | RemoveItemsOfType (MyFixedPoint amount, MyDefinitionId contentId, MyItemFlags flags=MyItemFlags.None, bool spawn=false) |
Remove items of a given amount and definition More... | |
MyInventoryBase | GetInventory (MyStringHash id) |
void | AfterComponentAdd (MyComponentBase component) |
void | BeforeComponentRemove (MyComponentBase component) |
override MyObjectBuilder_ComponentBase | Serialize (bool copy=false) |
override void | Deserialize (MyObjectBuilder_ComponentBase builder) |
override void | CountItems (Dictionary< MyDefinitionId, MyFixedPoint > itemCounts) |
override void | ApplyChanges (List< MyComponentChange > changes) |
override bool | ItemsCanBeAdded (MyFixedPoint amount, IMyInventoryItem item) |
override bool | ItemsCanBeRemoved (MyFixedPoint amount, IMyInventoryItem item) |
override bool | Add (IMyInventoryItem item, MyFixedPoint amount) |
override bool | Remove (IMyInventoryItem item, MyFixedPoint amount) |
override List< MyPhysicalInventoryItem > | GetItems () |
override void | OnContentsChanged () |
override void | OnBeforeContentsChanged () |
override bool | TransferItemsFrom (MyInventoryBase sourceInventory, IMyInventoryItem item, MyFixedPoint amount) |
Transfers safely given item from inventory given as parameter to this instance. More... | |
override void | ConsumeItem (MyDefinitionId itemId, MyFixedPoint amount, long consumerEntityId=0) |
override int | GetInventoryCount () |
Returns number of embedded inventories - this inventory can be aggregation of other inventories. More... | |
override MyInventoryBase | IterateInventory (int searchIndex, int currentIndex) |
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... | |
Public Member Functions inherited from VRage.Game.Entity.MyInventoryBase | |
MyInventoryBase (string inventoryId) | |
override void | Deserialize (MyObjectBuilder_ComponentBase builder) |
override MyObjectBuilder_ComponentBase | Serialize (bool copy=false) |
override string | ToString () |
virtual int | GetItemsCount () |
Returns the number of items in the inventory. This needs to be overrided, otherwise it returns 0! More... | |
override bool | IsSerialized () |
Tells the component container serializer whether this component should be saved More... | |
void | RaiseContentsChanged () |
void | RaiseBeforeContentsChanged () |
Public Member Functions inherited from VRage.Game.Components.MyEntityComponentBase | |
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... | |
Public Member Functions inherited from VRage.Game.Components.MyComponentBase | |
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) |
Static Public Member Functions | |
static MyInventoryAggregate | FixInputOutputInventories (MyInventoryAggregate inventoryAggregate, MyInventoryConstraint inputInventoryConstraint, MyInventoryConstraint outputInventoryConstraint) |
Naive looking for inventories with some items.. More... | |
Properties | |
override MyFixedPoint | CurrentMass [get] |
override MyFixedPoint | MaxMass [get] |
override MyFixedPoint | CurrentVolume [get] |
override MyFixedPoint | MaxVolume [get] |
override int | MaxItemCount [get] |
override float | ForcedPriority [get, set] |
int | InventoryCount [get] |
Returns number of inventories of MyInventory type contained in this aggregate More... | |
MyAggregateComponentList | ChildList [get] |
Properties inherited from VRage.Game.Entity.MyInventoryBase | |
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] |
Properties inherited from VRage.Game.Components.MyEntityComponentBase | |
MyEntityComponentContainer | Container [get] |
IMyEntity | Entity [get] |
abstract string | ComponentTypeDebugString [get] |
Name of the base component type for debug purposes (e.g.: "Position") More... | |
Properties inherited from VRage.Game.Components.MyComponentBase | |
MyComponentContainer | ContainerBase [get] |
This cannot be named Container to not conflict with the definition of Container in MyEntityComponentBase. More... | |
Properties inherited from VRage.Game.Components.IMyComponentAggregate | |
MyAggregateComponentList | ChildList [get] |
MyComponentContainer | ContainerBase [get] |
Events | |
virtual Action< MyInventoryAggregate, MyInventoryBase > | OnAfterComponentAdd |
virtual Action< MyInventoryAggregate, MyInventoryBase > | OnBeforeComponentRemove |
Action< MyInventoryAggregate, int > | OnInventoryCountChanged |
Events inherited from VRage.Game.Entity.MyInventoryBase | |
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... | |
Events inherited from VRage.Game.Components.MyEntityComponentBase | |
static Action< MyEntityComponentBase > | OnAfterAddedToContainer |
Action< MyEntityComponentBase > | BeforeRemovedFromContainer |
Additional Inherited Members | |
Public Attributes inherited from VRage.Game.Entity.MyInventoryBase | |
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 inherited from VRage.Game.Entity.MyInventoryBase | |
void | OnOwnerChanged () |
This class implements basic functionality for the interface IMyInventoryAggregate. Use it as base class only if the basic functionality is enough.
Definition at line 27 of file MyInventoryAggregate.cs.
|
inline |
Definition at line 156 of file MyInventoryAggregate.cs.
|
inline |
Definition at line 158 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 379 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Adds item to inventory
amount | |
objectBuilder | |
index |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 205 of file MyInventoryAggregate.cs.
|
inline |
Implements VRage.Game.Components.IMyComponentAggregate.
Definition at line 256 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 350 of file MyInventoryAggregate.cs.
|
inline |
Implements VRage.Game.Components.IMyComponentAggregate.
Definition at line 281 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 185 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 525 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 342 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Reimplemented from VRage.Game.Components.MyComponentBase.
Definition at line 325 of file MyInventoryAggregate.cs.
|
inline |
Definition at line 170 of file MyInventoryAggregate.cs.
|
inlinestatic |
Naive looking for inventories with some items..
Definition at line 624 of file MyInventoryAggregate.cs.
|
inline |
Definition at line 241 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Returns number of embedded inventories - this inventory can be aggregation of other inventories.
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 535 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 195 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 399 of file MyInventoryAggregate.cs.
|
inline |
Definition at line 161 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 359 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 369 of file MyInventoryAggregate.cs.
|
inlinevirtual |
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.
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 547 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 418 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 409 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 389 of file MyInventoryAggregate.cs.
|
inlinevirtual |
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 |
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 231 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Reimplemented from VRage.Game.Components.MyComponentBase.
Definition at line 306 of file MyInventoryAggregate.cs.
|
inlinevirtual |
Transfers safely given item from inventory given as parameter to this instance.
Implements VRage.Game.Entity.MyInventoryBase.
Definition at line 427 of file MyInventoryAggregate.cs.
|
get |
Definition at line 252 of file MyInventoryAggregate.cs.
|
get |
Definition at line 38 of file MyInventoryAggregate.cs.
|
get |
Definition at line 64 of file MyInventoryAggregate.cs.
|
getset |
Definition at line 112 of file MyInventoryAggregate.cs.
|
get |
Returns number of inventories of MyInventory type contained in this aggregate
Definition at line 132 of file MyInventoryAggregate.cs.
|
get |
Definition at line 90 of file MyInventoryAggregate.cs.
|
get |
Definition at line 51 of file MyInventoryAggregate.cs.
|
get |
Definition at line 77 of file MyInventoryAggregate.cs.
virtual Action<MyInventoryAggregate, MyInventoryBase> Sandbox.Game.Entities.Inventory.MyInventoryAggregate.OnAfterComponentAdd |
Definition at line 30 of file MyInventoryAggregate.cs.
virtual Action<MyInventoryAggregate, MyInventoryBase> Sandbox.Game.Entities.Inventory.MyInventoryAggregate.OnBeforeComponentRemove |
Definition at line 31 of file MyInventoryAggregate.cs.
Action<MyInventoryAggregate, int> Sandbox.Game.Entities.Inventory.MyInventoryAggregate.OnInventoryCountChanged |
Definition at line 126 of file MyInventoryAggregate.cs.