Space Engineers
Public Member Functions | Properties | List of all members
Sandbox.Game.EntityComponents.MyModStorageComponent Class Reference

Component that stores custom mod data for an entity. Shared by all mods. NOTE: Create an EntityComponents.sbc with your mod's GUIDs to make sure data is saved. This allows data to remain in the world file until the user removes the mod. More...

Inheritance diagram for Sandbox.Game.EntityComponents.MyModStorageComponent:
VRage.Game.Components.MyModStorageComponentBase VRage.Game.Components.MyEntityComponentBase VRage.Game.Components.MyComponentBase

Public Member Functions

override bool IsSerialized ()
 Tells the component container serializer whether this component should be saved More...
 
override string GetValue (Guid guid)
 Gets a value from the Storage dictionary with the specified key. More...
 
override bool TryGetValue (Guid guid, out string value)
 Trys to a value from the Storage dictionary with the specified key. More...
 
override void SetValue (Guid guid, string value)
 Stores a value with the specified key into the Storage dictionary. More...
 
override bool RemoveValue (Guid guid)
 Removes a value with the specified key from the Storage dictionary. More...
 
override MyObjectBuilder_ComponentBase Serialize (bool copy=false)
 
override void Deserialize (MyObjectBuilder_ComponentBase builder)
 
- Public Member Functions inherited from VRage.Game.Components.MyModStorageComponentBase
override MyObjectBuilder_ComponentBase Serialize (bool copy=false)
 
void Add (KeyValuePair< Guid, string > item)
 
void Add (Guid key, string value)
 
void Clear ()
 
bool Contains (KeyValuePair< Guid, string > item)
 
bool ContainsKey (Guid key)
 
void CopyTo (KeyValuePair< Guid, string >[] array, int arrayIndex)
 
IEnumerator< KeyValuePair< Guid, string > > GetEnumerator ()
 
bool Remove (KeyValuePair< Guid, string > item)
 
bool Remove (Guid key)
 
- 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)
 

Properties

IReadOnlyDictionary< Guid, string > Storage [get]
 Store custom mod data here. Use a GUID unique to your mod. Use only system types, not custom types in mod script or game. More...
 
- Properties inherited from VRage.Game.Components.MyModStorageComponentBase
override string ComponentTypeDebugString [get]
 
string this[Guid key] [get, set]
 
int Count [get]
 
bool IsReadOnly [get]
 
ICollection< Guid > Keys [get]
 
ICollection< string > Values [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...
 

Additional Inherited Members

- Protected Attributes inherited from VRage.Game.Components.MyModStorageComponentBase
IDictionary< Guid, string > m_storageData = new Dictionary<Guid, string>()
 
- Events inherited from VRage.Game.Components.MyEntityComponentBase
static Action< MyEntityComponentBaseOnAfterAddedToContainer
 
Action< MyEntityComponentBaseBeforeRemovedFromContainer
 

Detailed Description

Component that stores custom mod data for an entity. Shared by all mods. NOTE: Create an EntityComponents.sbc with your mod's GUIDs to make sure data is saved. This allows data to remain in the world file until the user removes the mod.

Definition at line 20 of file MyModStorageComponent.cs.

Member Function Documentation

override void Sandbox.Game.EntityComponents.MyModStorageComponent.Deserialize ( MyObjectBuilder_ComponentBase  builder)
inlinevirtual

Reimplemented from VRage.Game.Components.MyComponentBase.

Definition at line 105 of file MyModStorageComponent.cs.

override string Sandbox.Game.EntityComponents.MyModStorageComponent.GetValue ( Guid  guid)
inlinevirtual

Gets a value from the Storage dictionary with the specified key.

Template Parameters
T
Parameters
guid
Returns

This can throw exceptions

Implements VRage.Game.Components.MyModStorageComponentBase.

Definition at line 40 of file MyModStorageComponent.cs.

override bool Sandbox.Game.EntityComponents.MyModStorageComponent.IsSerialized ( )
inlinevirtual

Tells the component container serializer whether this component should be saved

Returns

Reimplemented from VRage.Game.Components.MyComponentBase.

Definition at line 34 of file MyModStorageComponent.cs.

override bool Sandbox.Game.EntityComponents.MyModStorageComponent.RemoveValue ( Guid  guid)
inlinevirtual

Removes a value with the specified key from the Storage dictionary.

Parameters
guid

Implements VRage.Game.Components.MyModStorageComponentBase.

Definition at line 61 of file MyModStorageComponent.cs.

override MyObjectBuilder_ComponentBase Sandbox.Game.EntityComponents.MyModStorageComponent.Serialize ( bool  copy = false)
inlinevirtual

Reimplemented from VRage.Game.Components.MyComponentBase.

Definition at line 68 of file MyModStorageComponent.cs.

override void Sandbox.Game.EntityComponents.MyModStorageComponent.SetValue ( Guid  guid,
string  value 
)
inlinevirtual

Stores a value with the specified key into the Storage dictionary.

Template Parameters
T
Parameters
guid
value

Implements VRage.Game.Components.MyModStorageComponentBase.

Definition at line 56 of file MyModStorageComponent.cs.

override bool Sandbox.Game.EntityComponents.MyModStorageComponent.TryGetValue ( Guid  guid,
out string  value 
)
inlinevirtual

Trys to a value from the Storage dictionary with the specified key.

Template Parameters
T
Parameters
guid
value
Returns
true on success; false on failure

Implements VRage.Game.Components.MyModStorageComponentBase.

Definition at line 45 of file MyModStorageComponent.cs.

Property Documentation

IReadOnlyDictionary<Guid, string> Sandbox.Game.EntityComponents.MyModStorageComponent.Storage
get

Store custom mod data here. Use a GUID unique to your mod. Use only system types, not custom types in mod script or game.

This is not synced. Caution, this contains data for all mods. It is recommended to use the appropriate methods instead (GetValue, TryGetValue, SetValue, RemoveValue).

Definition at line 30 of file MyModStorageComponent.cs.


The documentation for this class was generated from the following file: