QcPathCell Namespace
What a block state is to a walking creature looking for a path (decisions E-400, E-402), one byte per state, computed once from the content: the kind of cell, two flags and the height of a low block (or, for a solid block, whether it is slippery). More...
| Header: | #include <server/pathing/QcPathCells.h> |
Types
| enum class | Kind { Open, Low, Solid, Tall, Water, …, Ladder } |
Variables
Functions
| quint8 | classify(const QcContentRegistry &content, QcBlockId id) |
| QcPathGap | gapOf(const QcContentRegistry &content, QcBlockId id) |
| bool | hasPanel(quint8 cell) |
| QcPathCell::Kind | kindOf(quint8 cell) |
| double | liftOf(quint8 cell) |
| quint8 | make(QcPathCell::Kind kind, quint8 flags = 0) |
Detailed Description
The path grid (QcPathGrid) reads only this table, never the block definitions.
Type Documentation
enum class QcPathCell::Kind
What a body meets in a cell.
| Constant | Value | Description |
|---|---|---|
QcPathCell::Kind::Open | 0 | No collision box (air, plants, torches, open doors, gates and trapdoors). |
QcPathCell::Kind::Low | 1 | Collision only in the lower half (bottom slabs, carpets, snow layers, closed bottom trapdoors): a body stands in the cell, on top of it (liftOf). |
QcPathCell::Kind::Solid | 2 | Collision reaching into the upper half over most of the cell's ground (full blocks, stairs, closed top trapdoors): a floor, never passable. |
QcPathCell::Kind::Tall | 3 | Collision reaching into the cell above (fences, walls): neither passable nor a floor, and it also blocks the cell above. |
QcPathCell::Kind::Water | 4 | A liquid without contact damage: passable, a floor at its surface, avoided by walkers. |
QcPathCell::Kind::ClosedDoor | 5 | A closed wooden door or gate: blocks, unless the creature opens doors (QcPathRules::opensDoors). |
QcPathCell::Kind::Danger | 6 | Hurts on contact without being a floor (fire, lava): never entered. |
QcPathCell::Kind::Unknown | 7 | Not loaded or outside the world: never entered, never a floor. |
QcPathCell::Kind::Wall | 8 | Collision over less than half of the cell's ground that leaves no room for a body (panes, iron bars, closed iron doors that only a signal opens): never passable, never a floor. |
QcPathCell::Kind::Ladder | 9 | A ladder: its board at the side leaves room for a body, which holds on to it (a place to stand) and climbs up and down along it, if the creature climbs (QcPathRules::climbsLadders; otherwise it is open). |
Variable Documentation
const quint8 QcPathCell::kindMask
The bits of the kind.
const int QcPathCell::liftShift
The height of a low block's top in eighths of a block, minus one (0: a carpet, 3: a slab).
const quint8 QcPathCell::panelFlag
An open cell can have a panel (an open door's leaf, an open trapdoor, decision E-909): its gap (QcPathCellTable::gap) says how wide a body may be and which sides it does not cross. The flag shares its bit with the height of low blocks, which open cells do not have.
Function Documentation
quint8 QcPathCell::classify(const QcContentRegistry &content, QcBlockId id)
Returns the cell of the block state id of content.
QcPathGap QcPathCell::gapOf(const QcContentRegistry &content, QcBlockId id)
Returns the gap of the block state id of content: open doors and trapdoors have one beside their panel, every other state none.
bool QcPathCell::hasPanel(quint8 cell)
Returns whether cell is open with a panel in it.
QcPathCell::Kind QcPathCell::kindOf(quint8 cell)
Returns the kind of cell.
double QcPathCell::liftOf(quint8 cell)
Returns how high a body stands on the low block of cell (rounded up to an eighth); 0 for other kinds.
quint8 QcPathCell::make(QcPathCell::Kind kind, quint8 flags = 0)
Returns a cell of kind with flags.