QtCraft API C++ classes QML types Handbook

QcPistonPlanner Namespace

Plans of pistons (QcPistonPlan) against the world before anything moves (decision E-337). More...

Header: #include <server/signal/QcPistonPlanner.h>

Functions

std::optional<QcPistonPlan> extension(QcSignalPower power, QcBlockPos base, QcSignalState piston, const QcSignalDefinition &definition)
QList<QcPistonPlan> resolveConflicts(const QList<QcPistonPlan> &plans)
QcPistonPlan retraction(QcSignalPower power, QcBlockPos base, QcSignalState piston, const QcSignalDefinition &definition, bool letGo)

Detailed Description

Function Documentation

std::optional<QcPistonPlan> QcPistonPlanner::extension(QcSignalPower power, QcBlockPos base, QcSignalState piston, const QcSignalDefinition &definition)

Returns the push of the piston of definition at base, as power sees the world: the line of blocks in front of it up to air or a block that breaks. std::nullopt when it is longer than the push limit, holds an immovable block (bedrock, an extended piston, a piston head) or reaches into an unloaded chunk or out of the world.

QList<QcPistonPlan> QcPistonPlanner::resolveConflicts(const QList<QcPistonPlan> &plans)

Returns plans without every plan that touches a cell another plan of the same step touches: two pistons that want the same block or cell both stay where they are. The rule looks only at cells, never at directions or coordinates, so it gives the same answer in every rotation and place.

QcPistonPlan QcPistonPlanner::retraction(QcSignalPower power, QcBlockPos base, QcSignalState piston, const QcSignalDefinition &definition, bool letGo)

Returns the retraction of the piston of definition at base, as power sees the world: a sticky piston pulls the block two cells in front of it back into its head's cell unless letGo (its extension had not finished: block spitting) or that block cannot move.