QcPrimedExplosives Class
The lit explosives of a world (decision E-601), the table of their kind in the entity register: each falls like a falling block (the shared physics, the same size) and counts its fuse down while its chunk is loaded. More...
| Header: | #include <server/explosions/QcPrimedExplosives.h> |
Public Functions
| QList<QcPrimedExplosive> | adopt(const QList<QcPrimedExplosive> &primed, const std::function<quint32 ()> &nextEntityId) |
| const QList<QcPrimedExplosive> & | all() const |
| QList<QcPrimedExplosive> & | editableAll() |
| bool | isFull() const |
| bool | prime(QcBlockPos cell, QcBlockId block, int fuse, quint32 id, double sideways) |
| qsizetype | removeInChunk(QcChunkPos chunk) |
| void | setLimit(qsizetype limit) |
| QList<QcPrimedExplosive> | tick(const QcBlockAccess &world, double dt, qsizetype most) |
Static Public Members
| const double | hopSide |
| const double | hopUp |
| const double | size |
| QcFallingBlock | unlit(const QcPrimedExplosive &primed) |
Detailed Description
Their number is bounded (QcServerLimits::primedExplosives): beyond it nothing is lit, and an explosive stays a block.
Member Function Documentation
QList<QcPrimedExplosive> QcPrimedExplosives::adopt(const QList<QcPrimedExplosive> &primed, const std::function<quint32 ()> &nextEntityId)
Takes the saved primed back (a chunk came back, decision E-374), ids from nextEntityId; returns the ones left out at the limit.
const QList<QcPrimedExplosive> &QcPrimedExplosives::all() const
Returns every lit explosive.
QList<QcPrimedExplosive> &QcPrimedExplosives::editableAll()
Returns the lit explosives for moving them from outside (pistons push them); never add or remove through it.
bool QcPrimedExplosives::isFull() const
Returns whether no more explosives may be lit.
bool QcPrimedExplosives::prime(QcBlockPos cell, QcBlockId block, int fuse, quint32 id, double sideways)
Lights the explosive block standing at cell with fuse ticks, with id id and its hop to the side sideways (radians). Returns false when the table is full.
qsizetype QcPrimedExplosives::removeInChunk(QcChunkPos chunk)
Removes those inside chunk. Returns how many.
void QcPrimedExplosives::setLimit(qsizetype limit)
Sets the number of explosives lit at once to at most limit.
QList<QcPrimedExplosive> QcPrimedExplosives::tick(const QcBlockAccess &world, double dt, qsizetype most)
Runs one tick of dt seconds in world for the awake ones (QcEntities::settle): physics and their fuses. Returns the ones whose fuse ran out, at most most, in the order of the table, and takes them out; the others with a fuse run out wait at 0 for the next tick. Those that fall below the world are gone.
[static] QcFallingBlock QcPrimedExplosives::unlit(const QcPrimedExplosive &primed)
Returns primed put out: a falling block of its explosive where it is, which lands as the block (a saved one beyond the limit is not lost).
Member Variable Documentation
const double QcPrimedExplosives::size
Edge length of the cube, like a falling block's.