Space Engineers
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
VRage.Game.MyDefinitionId Struct Reference

Prefer getting definition ID using object builder used to create the item. If you have automatic rifle, in its Init method create new MyDefinitionId using TypeId and SubtypeName of object builder. Do not write specific values in code, as data comes from XML and if those change, code needs to change as well. More...

Inheritance diagram for VRage.Game.MyDefinitionId:

Classes

class  DefinitionIdComparerType
 

Public Member Functions

 MyDefinitionId (MyObjectBuilderType type)
 
 MyDefinitionId (MyObjectBuilderType type, string subtypeName)
 
 MyDefinitionId (MyObjectBuilderType type, MyStringHash subtypeId)
 
 MyDefinitionId (MyRuntimeObjectBuilderId type, MyStringHash subtypeId)
 
override int GetHashCode ()
 
long GetHashCodeLong ()
 Safer hash code. It is unique in more situations than GetHashCode would be, but it may still require full check. More...
 
override bool Equals (object obj)
 
override string ToString ()
 
bool Equals (MyDefinitionId other)
 

Static Public Member Functions

static MyDefinitionId FromContent (MyObjectBuilder_Base content)
 Creates a new definition ID from a given content. More...
 
static MyDefinitionId Parse (string id)
 Attempts to create a definition ID from a definition string, which has the form (using ores as an example) "MyObjectBuilder_Ore/Iron". The first part must represent an existing type. If it does not, an exception will be thrown. The second (the subtype) is not enforced. See TryParse for a parsing method that does not throw an exception. More...
 
static bool TryParse (string id, out MyDefinitionId definitionId)
 Attempts to create a definition ID from a definition string, which has the form (using ores as an example) "MyObjectBuilder_Ore/Iron". The first part must represent an existing type, while the second (the subtype) is not enforced. More...
 
static bool operator== (MyDefinitionId l, MyDefinitionId r)
 
static bool operator!= (MyDefinitionId l, MyDefinitionId r)
 
static implicit operator MyDefinitionId (SerializableDefinitionId v)
 
static implicit operator SerializableDefinitionId (MyDefinitionId v)
 

Public Attributes

readonly MyObjectBuilderType TypeId
 
readonly MyStringHash SubtypeId
 

Static Public Attributes

static readonly DefinitionIdComparerType Comparer = new DefinitionIdComparerType()
 

Properties

string SubtypeName [get]
 

Detailed Description

Prefer getting definition ID using object builder used to create the item. If you have automatic rifle, in its Init method create new MyDefinitionId using TypeId and SubtypeName of object builder. Do not write specific values in code, as data comes from XML and if those change, code needs to change as well.

Definition at line 18 of file MyDefinitionId.cs.

Constructor & Destructor Documentation

VRage.Game.MyDefinitionId.MyDefinitionId ( MyObjectBuilderType  type)
inline

Definition at line 106 of file MyDefinitionId.cs.

VRage.Game.MyDefinitionId.MyDefinitionId ( MyObjectBuilderType  type,
string  subtypeName 
)
inline

Definition at line 111 of file MyDefinitionId.cs.

VRage.Game.MyDefinitionId.MyDefinitionId ( MyObjectBuilderType  type,
MyStringHash  subtypeId 
)
inline

Definition at line 116 of file MyDefinitionId.cs.

VRage.Game.MyDefinitionId.MyDefinitionId ( MyRuntimeObjectBuilderId  type,
MyStringHash  subtypeId 
)
inline

Definition at line 122 of file MyDefinitionId.cs.

Member Function Documentation

override bool VRage.Game.MyDefinitionId.Equals ( object  obj)
inline

Definition at line 143 of file MyDefinitionId.cs.

bool VRage.Game.MyDefinitionId.Equals ( MyDefinitionId  other)
inline

Definition at line 155 of file MyDefinitionId.cs.

static MyDefinitionId VRage.Game.MyDefinitionId.FromContent ( MyObjectBuilder_Base  content)
inlinestatic

Creates a new definition ID from a given content.

Parameters
content
Returns

Definition at line 25 of file MyDefinitionId.cs.

override int VRage.Game.MyDefinitionId.GetHashCode ( )
inline

Definition at line 128 of file MyDefinitionId.cs.

long VRage.Game.MyDefinitionId.GetHashCodeLong ( )
inline

Safer hash code. It is unique in more situations than GetHashCode would be, but it may still require full check.

Returns
64-bit hash code.

Definition at line 138 of file MyDefinitionId.cs.

static implicit VRage.Game.MyDefinitionId.operator MyDefinitionId ( SerializableDefinitionId  v)
inlinestatic

Definition at line 171 of file MyDefinitionId.cs.

static implicit VRage.Game.MyDefinitionId.operator SerializableDefinitionId ( MyDefinitionId  v)
inlinestatic

Definition at line 177 of file MyDefinitionId.cs.

static bool VRage.Game.MyDefinitionId.operator!= ( MyDefinitionId  l,
MyDefinitionId  r 
)
inlinestatic

Definition at line 166 of file MyDefinitionId.cs.

static bool VRage.Game.MyDefinitionId.operator== ( MyDefinitionId  l,
MyDefinitionId  r 
)
inlinestatic

Definition at line 161 of file MyDefinitionId.cs.

static MyDefinitionId VRage.Game.MyDefinitionId.Parse ( string  id)
inlinestatic

Attempts to create a definition ID from a definition string, which has the form (using ores as an example) "MyObjectBuilder_Ore/Iron". The first part must represent an existing type. If it does not, an exception will be thrown. The second (the subtype) is not enforced. See TryParse for a parsing method that does not throw an exception.

Parameters
id
Returns

Definition at line 37 of file MyDefinitionId.cs.

override string VRage.Game.MyDefinitionId.ToString ( )
inline

Definition at line 148 of file MyDefinitionId.cs.

static bool VRage.Game.MyDefinitionId.TryParse ( string  id,
out MyDefinitionId  definitionId 
)
inlinestatic

Attempts to create a definition ID from a definition string, which has the form (using ores as an example) "MyObjectBuilder_Ore/Iron". The first part must represent an existing type, while the second (the subtype) is not enforced.

Parameters
id
definitionId
Returns

Definition at line 52 of file MyDefinitionId.cs.

Member Data Documentation

readonly DefinitionIdComparerType VRage.Game.MyDefinitionId.Comparer = new DefinitionIdComparerType()
static

Definition at line 95 of file MyDefinitionId.cs.

readonly MyStringHash VRage.Game.MyDefinitionId.SubtypeId

Definition at line 99 of file MyDefinitionId.cs.

readonly MyObjectBuilderType VRage.Game.MyDefinitionId.TypeId

Definition at line 98 of file MyDefinitionId.cs.

Property Documentation

string VRage.Game.MyDefinitionId.SubtypeName
get

Definition at line 102 of file MyDefinitionId.cs.


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