QcWorldMirror Class
The world as the server sends it (part of QcClientSession, decision E-717): the content, the blocks of the loaded chunks with the local player's predicted changes on top (QcBlockMirror, decision E-853; QcClientWorld, there from the content on), what the chunks carry besides their blocks (QcChunkExtras), the world time and the weather. More...
| Header: | #include <clientcore/session/QcWorldMirror.h> |
Public Types
Public Functions
| void | addInk(const QcMsg::EntityMoves &moves, const QHash<quint32, QcClientEntity> &entities, quint64 now) |
| double | animationSeconds(double alpha) const |
| const QcBlockMirror & | blocks() const |
| const std::shared_ptr<const QcContentRegistry> & | content() const |
| const QcChunkExtras & | extras() const |
| std::optional<QcWorldMirror::Change> | handle(const QcMessage &message, const QcVec3 &eye, quint64 now) |
| const QcInkClouds & | inkClouds() const |
| const QcClientMaps & | maps() const |
| QList<QcBlockMirror::Changed> | predict(quint32 sequence, const QList<QcMsg::BlockUpdate> &blocks) |
| void | tick(quint64 now) |
| double | timeAt(double alpha) const |
| double | timeSpeed() const |
| QcClientWeather & | weather() |
| const QcClientWeather & | weather() const |
| const QcClientWorld * | world() const |
| double | worldTime() const |
Detailed Description
It takes the server's world messages and tells what they changed; the session reports that through its signals.
Member Type Documentation
[alias] QcWorldMirror::Change
What a world message changed.
Member Function Documentation
void QcWorldMirror::addInk(const QcMsg::EntityMoves &moves, const QHash<quint32, QcClientEntity> &entities, quint64 now)
Adds the clouds of ink of the creatures of entities that moves tell were struck (kinds with QcMobDefinition::ink), at the client's tick count now; nothing before the content.
double QcWorldMirror::animationSeconds(double alpha) const
Returns the seconds the world's animations show at alpha (0–1) of the way to the next tick (QcEffectClock): running with or without the time of day, standing while the server stands.
const QcBlockMirror &QcWorldMirror::blocks() const
Returns the blocks with the predictions.
const std::shared_ptr<const QcContentRegistry> &QcWorldMirror::content() const
Returns the content the server sent; null until it arrived.
const QcChunkExtras &QcWorldMirror::extras() const
Returns the labels (E-222), spinning spawner creatures (E-520), campfire items (E-772), sign texts (E-766) and explosions (E-604) of the loaded chunks.
std::optional<QcWorldMirror::Change> QcWorldMirror::handle(const QcMessage &message, const QcVec3 &eye, quint64 now)
Returns the change message made when it is a world message, none for a message of another group; eye hears the thunder of a lightning strike, now is the client's tick count.
const QcInkClouds &QcWorldMirror::inkClouds() const
Returns the clouds of ink of struck squids (decision E-974).
const QcClientMaps &QcWorldMirror::maps() const
Returns the maps the server sent (decision E-802).
QList<QcBlockMirror::Changed> QcWorldMirror::predict(quint32 sequence, const QList<QcMsg::BlockUpdate> &blocks)
Shows the blocks the local player's action numbered sequence is expected to set and returns the cells that changed (QcBlockMirror::predict).
void QcWorldMirror::tick(quint64 now)
One client tick, the tick count now: explosions and clouds of ink fade, the world time runs on while the time of day runs, the animations' clock runs on while the server runs.
double QcWorldMirror::timeAt(double alpha) const
Returns the world time a frame shows alpha (0..1) of the way to the next tick: worldTime() plus that share of the next tick's step, none while the time stands still (time of day frozen, server paused, decision E-960), so the sun does not swing back and forth with each tick.
double QcWorldMirror::timeSpeed() const
Returns the server's ticks per normal tick (WorldTime::speed): 1 at its normal rate, more in a sprint, 0 frozen.
QcClientWeather &QcWorldMirror::weather()
Returns the weather as shown: strengths, climate, lightning flashes (decision E-395).
const QcClientWeather &QcWorldMirror::weather() const
Returns the weather as shown, read-only.
const QcClientWorld *QcWorldMirror::world() const
Returns the blocks of the loaded chunks; null until the content arrived.
double QcWorldMirror::worldTime() const
Returns the seconds of world time, advanced locally between server updates while the time of day runs, by timeSpeed() per tick (the server's tick rate or sprint, WorldTime::speed).