QcServerState Class
The world, the clients and the entities of the authoritative server, shared by its parts (decision E-367): each part is reached through its own accessor and keeps its data behind its own interface; what changes at the level of the whole server (the clock, the player list) changes through a named function. More...
| Header: | #include <server/core/QcServerState.h> |
Public Functions
| QcServerState(const QcServerState &) | |
| ~QcServerState() | |
| QcAccessList & | access() |
| const QcAccessList & | access() const |
| QcServerAdvancements & | advancements() |
| void | applyLimits() |
| QcBlockEntities & | blockEntities() |
| const QcBlockEntities & | blockEntities() const |
| QcCircuitState & | circuits() |
| const QcCircuitState & | circuits() const |
| const std::vector<std::unique_ptr<QcServerClient>> & | clients() const |
| const QcServerClock & | clock() const |
| QcServerConfig & | config() |
| const QcServerConfig & | config() const |
| const QcContactDamage & | contactDamage() const |
| const QcContentRegistry & | content() const |
| const std::shared_ptr<const QcContentRegistry> & | contentPointer() const |
| QcEntities & | entities() |
| const QcEntities & | entities() const |
| QcPlantGrowth & | growth() |
| const QcItemDefinition * | heldItem(const QcServerClient &client) const |
| QcHopperQueue & | hoppers() |
| QcIdentityStore & | identities() |
| QcWorldInfo & | info() |
| const QcWorldInfo & | info() const |
| bool | isLoadedAt(QcBlockPos pos) const |
| QcLiquidFlow & | liquids() |
| const QcLiquidFlow & | liquids() const |
| const QcMachineRules & | machineRules() const |
| QcMapStore & | maps() |
| const QcMapStore & | maps() const |
| void | noteContents(QcBlockPos pos) |
| void | notePlayerListChanged() |
| QcPermission | permissionOf(const QcServerClient &client) const |
| QcPlantManager & | plants() |
| const QcPlantManager & | plants() const |
| QRandomGenerator & | random() |
| void | reportLatency(QcServerClient &client, qint32 reportedUs) |
| QRandomGenerator & | soundRandom() |
| QcSpawnPoint & | spawnPoint() |
| bool | takePlayerListChanged() |
| QcServerWorld & | world() |
| const QcServerWorld & | world() const |
| QcServerState & | operator=(const QcServerState &) |
Static Public Members
| const qint64 | latencyListIntervalNs |
Detailed Description
Lives in the server's thread like QcServer itself.
Member Function Documentation
[delete] QcServerState::QcServerState(const QcServerState &)
The parts keep references into it (QcEntities to the clients, QcSpawnPoint to the world).
[noexcept default] QcServerState::~QcServerState()
Destroys the instance of QcServerState.
QcAccessList &QcServerState::access()
Returns who may join and who is an operator.
const QcAccessList &QcServerState::access() const
Returns who may join and who is an operator, read-only.
QcServerAdvancements &QcServerState::advancements()
Returns the adventure guide (decision E-923): the gameplay reports events to it.
void QcServerState::applyLimits()
Hands the limits of the config to the parts that keep their own copy (decision E-349).
QcBlockEntities &QcServerState::blockEntities()
Returns the state that belongs to single blocks (decision E-357).
const QcBlockEntities &QcServerState::blockEntities() const
Returns the state that belongs to single blocks, read-only.
QcCircuitState &QcServerState::circuits()
Returns the Signal Dust circuits (decision E-335).
const QcCircuitState &QcServerState::circuits() const
Returns the Signal Dust circuits, read-only.
const std::vector<std::unique_ptr<QcServerClient>> &QcServerState::clients() const
Returns the connected clients; the parts may change a client, only QcServer adds and removes them.
const QcServerClock &QcServerState::clock() const
Returns the clock, read by every part; only QcServer advances it, once per tick.
QcServerConfig &QcServerState::config()
Returns the server's settings; a single-player world's limits replace those of the config (world.json).
const QcServerConfig &QcServerState::config() const
Returns the server's settings, read-only.
const QcContactDamage &QcServerState::contactDamage() const
Returns the damage of the blocks bodies touch (lava, magma).
const QcContentRegistry &QcServerState::content() const
Returns the content: blocks, items, creatures and the rest.
const std::shared_ptr<const QcContentRegistry> &QcServerState::contentPointer() const
Returns the shared pointer to the content, for parts that keep it.
QcEntities &QcServerState::entities()
Returns every entity of the world (decision E-364); players are the clients.
const QcEntities &QcServerState::entities() const
Returns every entity of the world, read-only.
QcPlantGrowth &QcServerState::growth()
Returns the random growth of plants, crops and soil.
const QcItemDefinition *QcServerState::heldItem(const QcServerClient &client) const
Returns the definition of the item client holds in the selected slot; nullptr for an empty hand or an unknown item.
QcHopperQueue &QcServerState::hoppers()
Returns the hoppers to look at (decision E-344).
QcIdentityStore &QcServerState::identities()
Returns the identities of remote players per name (decision E-252).
QcWorldInfo &QcServerState::info()
Returns world.json: name, seed, time of day, game rules.
const QcWorldInfo &QcServerState::info() const
Returns world.json, read-only.
bool QcServerState::isLoadedAt(QcBlockPos pos) const
Returns whether the chunk of pos is loaded.
QcLiquidFlow &QcServerState::liquids()
Returns the flow of liquids.
const QcLiquidFlow &QcServerState::liquids() const
Returns the flow of liquids, read-only.
const QcMachineRules &QcServerState::machineRules() const
Returns the rules of machines.
QcMapStore &QcServerState::maps()
Returns the maps of the world by map id (decision E-799).
const QcMapStore &QcServerState::maps() const
Returns the maps of the world by map id, read-only.
void QcServerState::noteContents(QcBlockPos pos)
The contents of the container or machine at pos changed (a screen, a hopper, a furnace): comparators reading it and hoppers next to it look again (decisions E-343, E-344).
void QcServerState::notePlayerListChanged()
Someone joined or left, or operator rights changed: the clients get the player list again.
QcPermission QcServerState::permissionOf(const QcServerClient &client) const
Returns the right of client: the local player (host of a single player world) and listed operators are operators, the others players (decision E-243).
QcPlantManager &QcServerState::plants()
Returns the growing plants.
const QcPlantManager &QcServerState::plants() const
Returns the growing plants, read-only.
QRandomGenerator &QcServerState::random()
Returns the random generator of the gameplay (drops, spawns).
void QcServerState::reportLatency(QcServerClient &client, qint32 reportedUs)
client reported its round trip reportedUs in microseconds (decision E-886). A change that shows in the list (QcListedLatency::changed) is listed and the list goes out again, at most once per latencyListIntervalNs of the players' time; smaller changes are ignored.
QRandomGenerator &QcServerState::soundRandom()
Returns the random generator of sounds, separate from random() so that sounds never change drops or spawns.
QcSpawnPoint &QcServerState::spawnPoint()
Returns where players appear.
bool QcServerState::takePlayerListChanged()
Returns whether the list changed since the last call, or round trips changed and their interval passed.
QcServerWorld &QcServerState::world()
Returns the world: chunks, blocks and what belongs to them.
const QcServerWorld &QcServerState::world() const
Returns the world, read-only.
[delete] QcServerState &QcServerState::operator=(const QcServerState &)
Copy-assigns other to this QcServerState instance. This function is deleted.
Member Variable Documentation
const qint64 QcServerState::latencyListIntervalNs
Round trips go out in the list at most once per this long of the players' time.