QtCraft API C++ classes QML types Handbook

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

const quint8 kindMask
const int liftShift
const quint8 panelFlag

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.

ConstantValueDescription
QcPathCell::Kind::Open0No collision box (air, plants, torches, open doors, gates and trapdoors).
QcPathCell::Kind::Low1Collision 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::Solid2Collision reaching into the upper half over most of the cell's ground (full blocks, stairs, closed top trapdoors): a floor, never passable.
QcPathCell::Kind::Tall3Collision reaching into the cell above (fences, walls): neither passable nor a floor, and it also blocks the cell above.
QcPathCell::Kind::Water4A liquid without contact damage: passable, a floor at its surface, avoided by walkers.
QcPathCell::Kind::ClosedDoor5A closed wooden door or gate: blocks, unless the creature opens doors (QcPathRules::opensDoors).
QcPathCell::Kind::Danger6Hurts on contact without being a floor (fire, lava): never entered.
QcPathCell::Kind::Unknown7Not loaded or outside the world: never entered, never a floor.
QcPathCell::Kind::Wall8Collision 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::Ladder9A 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.