KS.Reactor.ksEntityId Struct Reference

An entity id uint with type information. More...

Inheritance diagram for KS.Reactor.ksEntityId:
ksISerializable

Public Types

enum class  Types { UNASSIGNED = 0 , SERVER_ID = 1 , TEMPORARY_SPAWN_ID = 2 }
 Id types More...
 

Public Member Functions

 ksEntityId (uint id)
 Constructor More...
 
bool Equals (ksEntityId other)
 Checks if this id is equal to another. More...
 
override bool Equals (object obj)
 Checks if this id is equal to an object. More...
 
override int GetHashCode ()
 Gets a hash code. More...
 
override string ToString ()
 Converts the id number to a string. More...
 
void Serialize (ksStreamBuffer buffer)
 Serializes the id to a buffer. More...
 
void Deserialize (ksStreamBuffer buffer)
 Deserializes the id from a buffer. More...
 

Static Public Member Functions

static implicit operator ksEntityId (uint id)
 Implicit conversion from uint. More...
 
static implicit operator uint (ksEntityId id)
 Implicit conversion to uint. More...
 
static implicit operator ksEntityId (ksMultiType value)
 Implicit conversion from ksMultiType. More...
 
static implicit operator ksMultiType (ksEntityId id)
 Implicit conversion to ksMultiType. More...
 
static bool operator== (ksEntityId lhs, ksEntityId rhs)
 Checks if two ids are equal. More...
 
static bool operator!= (ksEntityId lhs, ksEntityId rhs)
 Checks if two ids are not equal. More...
 
static bool operator> (ksEntityId lhs, ksEntityId rhs)
 Checks if lhs is greater than rhs . More...
 
static bool operator< (ksEntityId lhs, ksEntityId rhs)
 Checks if lhs is less than rhs . More...
 

Static Public Attributes

const uint SPAWN_ID_START = 1u << 31
 The lowest spawn id value. More...
 

Properties

TypesType [get]
 Id type More...
 

Detailed Description

An entity id uint with type information.

The type can be a server entity id or a temporary spawn id that players use to identify entities they spawned before the server confirms the spawn and sends the server entity id. Internally the id is just a uint and the type is determined by which bits are set. If the highest bit is set, it's a temporary spawn id, otherwise it's a server entity id, unless the value is zero in which case it is invalid. Temporary spawn ids are not enough to identify an entity on the server; the id of the player who spawned the entity is also needed.

Member Enumeration Documentation

◆ Types

Id types

Enumerator
UNASSIGNED 

The id is unassigned (zero).

SERVER_ID 

The id is the entity id set by the server.

TEMPORARY_SPAWN_ID 

The id is a temporary spawn id used to identify entities spawned by players before the server confirms the spawn and sets the server entity id.

To get an entity on the server using a temporary spawn id, you must also provide the id of the player who spawned the entity.

Constructor & Destructor Documentation

◆ ksEntityId()

KS.Reactor.ksEntityId.ksEntityId ( uint  id)

Constructor

Parameters
idId

Member Function Documentation

◆ Deserialize()

void KS.Reactor.ksEntityId.Deserialize ( ksStreamBuffer  buffer)

Deserializes the id from a buffer.

Parameters
bufferBuffer to deserialize from.

Implements ksISerializable.

◆ Equals() [1/2]

bool KS.Reactor.ksEntityId.Equals ( ksEntityId  other)

Checks if this id is equal to another.

Parameters
other
Returns
True if the ids are equal.

◆ Equals() [2/2]

override bool KS.Reactor.ksEntityId.Equals ( object  obj)

Checks if this id is equal to an object.

Parameters
obj
Returns
True if the object was an equivalent id.

◆ GetHashCode()

override int KS.Reactor.ksEntityId.GetHashCode ( )

Gets a hash code.

Returns
Hash code

◆ operator ksEntityId() [1/2]

static implicit KS.Reactor.ksEntityId.operator ksEntityId ( ksMultiType  value)
static

Implicit conversion from ksMultiType.

Parameters
valueValue

◆ operator ksEntityId() [2/2]

static implicit KS.Reactor.ksEntityId.operator ksEntityId ( uint  id)
static

Implicit conversion from uint.

Parameters
idId

◆ operator ksMultiType()

static implicit KS.Reactor.ksEntityId.operator ksMultiType ( ksEntityId  id)
static

Implicit conversion to ksMultiType.

Parameters
idId

◆ operator uint()

static implicit KS.Reactor.ksEntityId.operator uint ( ksEntityId  id)
static

Implicit conversion to uint.

Parameters
idId

◆ operator!=()

static bool KS.Reactor.ksEntityId.operator!= ( ksEntityId  lhs,
ksEntityId  rhs 
)
static

Checks if two ids are not equal.

Parameters
lhs
rhs
Returns
True if the ids are not equal.

◆ operator<()

static bool KS.Reactor.ksEntityId.operator< ( ksEntityId  lhs,
ksEntityId  rhs 
)
static

Checks if lhs is less than rhs .

Parameters
lhs
rhs
Returns
True if lhs is less than rhs .

◆ operator==()

static bool KS.Reactor.ksEntityId.operator== ( ksEntityId  lhs,
ksEntityId  rhs 
)
static

Checks if two ids are equal.

Parameters
lhs
rhs
Returns
True if the ids are equal

◆ operator>()

static bool KS.Reactor.ksEntityId.operator> ( ksEntityId  lhs,
ksEntityId  rhs 
)
static

Checks if lhs is greater than rhs .

Parameters
lhs
rhs
Returns
True if lhs is greater than rhs .

◆ Serialize()

void KS.Reactor.ksEntityId.Serialize ( ksStreamBuffer  buffer)

Serializes the id to a buffer.

Parameters
bufferBuffer to serialize to.

Implements ksISerializable.

◆ ToString()

override string KS.Reactor.ksEntityId.ToString ( )

Converts the id number to a string.

If it is zero, the string "Unassigned" is returned.

Returns
The id as a string

Member Data Documentation

◆ SPAWN_ID_START

const uint KS.Reactor.ksEntityId.SPAWN_ID_START = 1u << 31
static

The lowest spawn id value.

Property Documentation

◆ Type

Types? KS.Reactor.ksEntityId.Type
get

Id type