Skip to main content

IChunker

An interface in Root.Township, the global namespace.

Server: a node in the tree that decides which players a networked object is spawned for, based on chunks. Chunker is the implementation.

Properties​

MemberWhat it is
int ChildCount { get; }How many child chunkers this one has.
IEnumerable<Chunker> Children { get; }Child chunkers, spawned and despawned along with this one.
Chunk Chunk { get; }The chunk this chunker's object belongs to.
NetworkEntity NetworkEntity { get; }The entity this chunker spawns.
Chunker Parent { get; }The parent chunker, if this object is a child of another.
HashSet<Player> SpawnedForPlayers { get; }The players this object is currently spawned for.

Methods​

MemberWhat it is
void EndDespawn(Player player, bool isUnloading, bool isChunkSync)Sends the destroy message for the entity to a player, after StartDespawn.
void EndSpawn(Player player, bool isChunkSync)Sends the entity's initial state to a player and runs its on-connected logic, after StartSpawn.
bool StartDespawn(Player player, bool hasMovedChunks, bool isChunkSync)Removes a player from SpawnedForPlayers and runs the entity's disconnect logic. False if it wasn't spawned for them.
bool StartSpawn(Player player, bool hasMovedChunks, bool isChunkSync)Adds a player to SpawnedForPlayers and sends them the spawn message. False if it was already spawned for them.

Used in​

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