QtCraft API C++ classes QML types Handbook

QcChunkLoaders Class

Chunk loader blocks (decision E-377): a block whose item carries the tag qtcraft:chunk_loaders keeps its own chunk loaded, and with it the group of circuits that chunk belongs to. More...

Header: #include <server/chunks/QcChunkLoaders.h>

Public Types

Loader

Public Functions

quint64 changes() const
QList<QcChunkPos> chunks(qsizetype limit) const
qsizetype count() const
qsizetype countOf(const QString &owner) const
bool isLoader(QcBlockId block) const
QList<QcChunkLoaders::Loader> loaders() const
void noteBlock(QcBlockPos pos, QcBlockId before, QcBlockId after)
void noteChunk(const QcChunk &chunk)
void restore(const QList<QcChunkLoaders::Loader> &loaders)
void setOwner(QcBlockPos pos, const QString &owner)

Static Public Members

const char *const tag

Detailed Description

The server knows every loader of the world, also those in chunks that are not loaded (they are kept in world.json), in the order they were placed; only the first QcServerLimits::chunkLoaders work. A player places at most chunkLoadersPerPlayer (QcServerInteraction); loaders set by commands or structures belong to no one.

Member Type Documentation

[alias] QcChunkLoaders::Loader

A placed loader: position and owner.

Member Function Documentation

quint64 QcChunkLoaders::changes() const

Returns the count of loaders found or gone (QcChunkLoading recomputes the needed chunks on a change).

QList<QcChunkPos> QcChunkLoaders::chunks(qsizetype limit) const

Returns the chunks the first limit loaders keep loaded.

qsizetype QcChunkLoaders::count() const

Returns the number of loaders in the world.

qsizetype QcChunkLoaders::countOf(const QString &owner) const

Returns the number of loaders owner placed.

bool QcChunkLoaders::isLoader(QcBlockId block) const

Returns whether the state block is a chunk loader.

QList<QcChunkLoaders::Loader> QcChunkLoaders::loaders() const

Returns all loaders in the order they were placed.

void QcChunkLoaders::noteBlock(QcBlockPos pos, QcBlockId before, QcBlockId after)

The block at pos changed from before to after in a loaded chunk.

void QcChunkLoaders::noteChunk(const QcChunk &chunk)

chunk entered the world: its loaders are known now, those it no longer has are forgotten.

void QcChunkLoaders::restore(const QList<QcChunkLoaders::Loader> &loaders)

Sets loaders of a saved world (world.json); unplausible entries were left out when it was read.

void QcChunkLoaders::setOwner(QcBlockPos pos, const QString &owner)

Gives the loader at pos the owner owner (empty: no one).

Member Variable Documentation

const char *const QcChunkLoaders::tag

The item tag that makes a block a chunk loader.