QcServerExplosions Class
Explosives and explosions in the server tick (decisions E-600 to E-604). More...
| Header: | #include <server/explosions/QcServerExplosions.h> |
Public Types
Public Functions
| quint64 | blocksBroken() const |
| bool | breaksBlocks() const |
| void | explode(const QcServerExplosions::Blast &blast) |
| bool | isExplosive(QcBlockId block) const |
| bool | light(QcBlockPos pos, std::optional<int> fuse = std::nullopt) |
| const QcServerExplosions::Numbers & | numbers() const |
| const QcBlastTable & | table() const |
| void | tick() |
| qsizetype | waitingCells() const |
Static Public Members
| const double | viewDistance |
Detailed Description
- An explosive block (QcBlastDefinition) is lit by flint and steel, a dispenser with it, fire burning it, signal power (QcSignalKind::Igniter) or another explosion: it leaves its cell and becomes a lit explosive (QcPrimedExplosive) that falls and counts its fuse down. Beyond the limit
primedExplosivesnothing is lit and the block stays. - When the fuse runs out it explodes: at most
explosionsPerTickper tick, the others wait with their fuse at 0 in the order of the table. A blast hurts and pushes the players and creatures that see it (QcBlastBodies) and, while the game rule explosionBlockDamage holds, breaks the cells its rays reach (QcExplosionRays, at mostexplosionBlocksof them, the nearest first), which QcBlastBlocks works through at mostexplosionBlocksPerTickper tick. Explosives among them are lit with a short fuse of their own (chainFuseMin to chainFuseMax ticks, by dice), so a chain of any size spreads over many ticks and no tick does more than its budgets allow. - Every explosion is sent to the clients near it (QcMsg::Explosion: flash and smoke) with its sound.
Member Function Documentation
quint64 QcServerExplosions::blocksBroken() const
Returns the blocks blasts broke since the server started.
bool QcServerExplosions::breaksBlocks() const
Returns whether explosions break blocks now: the game rule explosionBlockDamage.
void QcServerExplosions::explode(const QcServerExplosions::Blast &blast)
Sets off blast now (tests, commands and later creatures; lit explosives go through tick()).
bool QcServerExplosions::isExplosive(QcBlockId block) const
Returns whether block is an explosive.
bool QcServerExplosions::light(QcBlockPos pos, std::optional<int> fuse = std::nullopt)
Lights the explosive block at pos with its own fuse (or fuse ticks). Returns false when the cell holds no explosive, its chunk is not loaded or the table of lit explosives is full.
const QcServerExplosions::Numbers &QcServerExplosions::numbers() const
Returns the counts since the server started.
const QcBlastTable &QcServerExplosions::table() const
Returns the blast traits of the block states.
void QcServerExplosions::tick()
Counts the fuses down, sets off the due explosives and works through the waiting cells.
qsizetype QcServerExplosions::waitingCells() const
Returns the cells waiting to be broken.
Member Variable Documentation
const double QcServerExplosions::viewDistance
Clients hear and see an explosion this far away.