QtCraft API C++ classes QML types Handbook

QcPathRules Struct

How a creature moves through the cells (decision E-400): its height in cells, how far it drops, whether it swims, opens doors, climbs ladders and jumps into deep water. More...

Header: #include <server/pathing/QcPathTerrain.h>

Public Functions

bool fitsThrough(float opening) const
int footprint() const

Public Variables

bool avoidsWater
bool climbsLadders
bool climbsWalls
bool divesIntoWater
double height
qint16 maxDrop
bool opensDoors
bool swims
float width

Static Public Members

const double climbHeight
const int defaultMaxDrop
QcPathRules of(const QcMobDefinition &definition)
const double panelClearance
const int waterDrop

Detailed Description

Its flags are one bit each, so the rules stay small enough to pass by value.

Member Function Documentation

bool QcPathRules::fitsThrough(float opening) const

Returns whether the body fits through an opening opening wide beside a panel.

int QcPathRules::footprint() const

Returns the cells the body covers along each horizontal axis (decision E-909): one for a body at most a block wide, two for spiders and golems. Its feet cell is the corner cell of its lowest x and z, it walks along the middle of its cells (QcPathTerrain::pointOf).

[static] QcPathRules QcPathRules::of(const QcMobDefinition &definition)

Returns the rules of a creature of the kind definition.

Member Variable Documentation

bool QcPathRules::avoidsWater

Never stands in water on its paths (creatures that water hurts, QcMobDefinition::waterDamage, decision E-460).

const double QcPathRules::climbHeight

The highest rise a jump takes on a path: a block with a carpet or a snow layer on it (a jump reaches about 1.45 blocks, 1.25 on mud).

bool QcPathRules::climbsLadders

A creature that climbs holds on to a ladder (a place to stand) and goes up and down along it (villagers, decision E-411); to the others a ladder's cell is open like air (QcPathTerrain::kindOf).

bool QcPathRules::climbsWalls

A wall climber (spiders, decision E-451) also holds on to every cell beside a solid block, or whose cell above has one beside it (QcPathTerrain::holdsOn), and climbs up and down there.

const int QcPathRules::defaultMaxDrop

Drops deeper than this are refused (the reference's 3; creatures take no fall damage yet, the limit keeps them from leaping off cliffs all the same).

bool QcPathRules::divesIntoWater

Drops deeper than maxDrop, down to waterDrop, into deep water. Villagers keep to their boardwalks and jetties instead of jumping off them (decision E-411).

double QcPathRules::height

The body's height.

qint16 QcPathRules::maxDrop

The deepest drop it takes on a path (defaultMaxDrop).

bool QcPathRules::opensDoors

Closed doors and gates block unless the creature opens them: villagers do (decision E-411) and open the doors on their path when QcMobNavigator reports them.

const double QcPathRules::panelClearance

A body keeps at least this far from the panel beside it in an open door or trapdoor (decision E-909): the steering lines it up within as much (QcOpeningSteering::laneTolerance).

bool QcPathRules::swims

Water costs a walker much (it is used only without a dry way); a swimmer moves through it freely.

const int QcPathRules::waterDrop

Deeper drops, down to this many blocks, only into water at least two blocks deep.

float QcPathRules::width

The body's width: through an open door it keeps to the opening (decision E-905), as long as it overlaps the door's cell. A float and maxDrop short, so the rules stay 16 bytes and pass by value.