QcExplosionRays Namespace
How an explosion reaches blocks and bodies (decision E-602), pure so that craters and exposure are testable on their own. More...
| Header: | #include <server/explosions/QcExplosionRays.h> |
Classes
| struct | Blast |
Variables
| const int | grid |
| const double | reachFactor |
| const double | stepCost |
| const double | stepLength |
Functions
| QList<QcBlockPos> | broken(QcBlastField &field, const QcExplosionRays::Blast &blast, qsizetype limit) |
| double | exposure(QcBlastField &field, const QcVec3 ¢re, const QcAabb &box) |
| int | reach(double power) |
Detailed Description
Like the reference game: rays leave the centre towards the 1352 points on the surface of a 16 × 16 × 16 grid, each with a force of power × (0.7 to 1.3), and walk in steps of 0.3 blocks; every step costs 0.225 and a cell that is not air (resistance + 0.3) × 0.3 of the force, and a cell the ray still has force for after that breaks. The dice of a ray come from the world's seed, the cell of the centre and the ray, so the same explosion in the same world always leaves the same crater. A liquid soaks up a whole ray (resistance 100): a blast under water breaks nothing. A cell of a chunk that is not loaded stops its ray.
Classes
class Blast
One explosion as the rays see it: its centre, power and the world's seed for the dice. More...
Variable Documentation
const int QcExplosionRays::grid
Steps of the grid along each edge of the cube the rays point at.
const double QcExplosionRays::reachFactor
Bodies feel a blast up to twice its power away.
const double QcExplosionRays::stepCost
The force every step of a ray costs.
const double QcExplosionRays::stepLength
The length of a ray's step in blocks.
Function Documentation
QList<QcBlockPos> QcExplosionRays::broken(QcBlastField &field, const QcExplosionRays::Blast &blast, qsizetype limit)
Returns the cells of field the blast breaks, nearest to the centre first (ties in the order of x, y, z), at most limit; unbreakable cells (QcBlastDefinition::unbreakable) never.
double QcExplosionRays::exposure(QcBlastField &field, const QcVec3 ¢re, const QcAabb &box)
Returns the share (0..1) of points spread over box that see centre past the solid blocks of field.
int QcExplosionRays::reach(double power)
Returns the farthest a ray of power can break a block, in whole blocks (the size of a QcBlastField).