Skip to main content

SpawnIndex

A class in Root.Township, Alta.Networking.

Per-entity counter that orders spawns and despawns, so clients drop destroy messages that are older than the entity's latest spawn.

Constructors​

MemberWhat it is
SpawnIndex()Creates a SpawnIndex with default values.

Fields​

2 private and internal fields
MemberWhat it is
private uint indexBacking field for Index.
private bool wasLastDespawnSet by DespawningIndex; makes SpawningIndex step the index.

Properties​

MemberWhat it is
uint DespawningIndex { get; }Returns the current index and marks that a despawn happened, so the next spawn gets a higher index.
uint Index { get; set; }The current spawn index. DestroyMessage ignores a destroy whose index is lower than this.
uint SpawningIndex { get; }Returns the index for a new spawn, adding one if there was a despawn. The despawn flag is never cleared, so every read after one adds one.

Methods​

MemberWhat it is
static void SerializeIndex(Stream stream, ref uint index)Reads or writes an index on the stream in a compact form.

Used in​

Members of other types that take, return or hold a SpawnIndex: