QcClientEntities Class
Client mirror of the entities the server reports, with their animation timers and the ones that play their death animation. More...
| Header: | #include <clientcore/session/QcClientEntities.h> |
Public Functions
| const QHash<quint32, QcClientEntity> & | all() const |
| const QcSnapshotClock & | clock() const |
| const QHash<quint32, QcClientEntity> & | dying() const |
| bool | isBuffered() const |
| void | moves(const QcMsg::EntityMoves &moves) |
| void | moves(const QcMsg::EntityMoves &moves, qint64 localMs) |
| void | remove(QcMsg::EntityRemove removed) |
| void | restartClock() |
| void | setBuffered(bool buffered) |
| bool | spawn(const QcMsg::EntitySpawn &spawn, const QcContentRegistry *content) |
| void | stepSounds(const QcClientWorld &world, const Cue &cue) |
| void | tick() |
| void | tick(qint64 localMs, double serverTicks = 1.0) |
| void | tickBy(double serverTicks) |
Static Public Members
| const int | deathTicks |
| const int | hurtFlashTicks |
| const double | speedSmoothing |
| const float | stepVolume |
| const double | strideMetres |
| const int | swingTicks |
Detailed Description
Motion is shown a little in the past from buffered snapshots so that late or bunched messages do not make others stutter (decision E-271); health, flags and swings show when they arrive, a hurt flash when the shown moment reaches the hurt, together with its knockback (decision E-971).
Member Function Documentation
const QHash<quint32, QcClientEntity> &QcClientEntities::all() const
Returns the entities by id as the server last reported them.
const QcSnapshotClock &QcClientEntities::clock() const
Returns the snapshot clock: how far in the past motion is shown.
const QHash<quint32, QcClientEntity> &QcClientEntities::dying() const
Returns the removed entities that still play their death animation, by id.
bool QcClientEntities::isBuffered() const
Returns whether motion is shown from the snapshot buffer (setBuffered()).
void QcClientEntities::moves(const QcMsg::EntityMoves &moves)
Takes moves, arrived now on the internal steady clock of tick().
void QcClientEntities::moves(const QcMsg::EntityMoves &moves, qint64 localMs)
Takes moves that arrived at localMs on the clock of tick().
void QcClientEntities::remove(QcMsg::EntityRemove removed)
Removes the entity removed names; one that died plays its death animation first, except items, experience orbs and projectiles, which vanish at once.
void QcClientEntities::restartClock()
The server resumed after a pause (decision E-877): the snapshot clock starts anew.
void QcClientEntities::setBuffered(bool buffered)
Sets whether snapshots are buffered; without the buffer each tick shows the newest snapshot (for comparisons in tests).
See also isBuffered().
bool QcClientEntities::spawn(const QcMsg::EntitySpawn &spawn, const QcContentRegistry *content)
Takes the entity of spawn (creatures checked against content). Returns false when the server sent an unknown entity type.
template <typename Cue> void QcClientEntities::stepSounds(const QcClientWorld &world, const Cue &cue)
Passes a step sound to cue for every creature that walked a stride, on the ground of world.
void QcClientEntities::tick()
Moves every entity to its pose one tick after the shown moment, advances the animation timers and drops finished death animations.
void QcClientEntities::tick(qint64 localMs, double serverTicks = 1.0)
Like tickBy(), with localMs as the time on the clock of moves().
void QcClientEntities::tickBy(double serverTicks)
Like tick(), with serverTicks the server's ticks in this client tick (its tick rate or sprint; 0 while it stands still): the draws of others count those (decision E-987).
Member Variable Documentation
const int QcClientEntities::hurtFlashTicks
The red flash lasts the reference's hurt time (decision E-971).
const double QcClientEntities::speedSmoothing
Share of the newest tick in the smoothed walking speed.
const float QcClientEntities::stepVolume
Volume of a creature's step sound.
const double QcClientEntities::strideMetres
Creatures step every this many metres.