QtCraft API C++ classes QML types Handbook

QcPistonMover Class

Carries out piston plans (decision E-337). More...

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

Public Functions

qsizetype apply(const QcPistonPlan &plan)
void applyPushes()

Static Public Members

double pushDistance(const QcAabb &body, const QList<QcBlockPos> &cells, QcBlockFace towards)
const double pushGap

Detailed Description

Blocks move in the world at once, nearest last, each with its chest or furnace contents: the contents are re-keyed to the new cell before the block is set there, so nothing is dropped, copied or lost, also across chunk borders and in a save made in the middle of a move. Bodies in the cells the blocks and the head move into (every body of the entity register QcEntities: players, creatures, items, falling blocks, armour stands) are pushed out along the piston's direction by the server; players get their new position like any other server correction. The clients see the blocks slide (QcMovingBlocks).

Member Function Documentation

qsizetype QcPistonMover::apply(const QcPistonPlan &plan)

Carries out plan. Returns the work done: blocks moved or broken and bodies looked at.

void QcPistonMover::applyPushes()

Moves the bodies the step's plans pushed: per body the pushes of all plans together (so the order of the plans does not matter), against what is solid after the moves; a body left inside a block goes to the nearest free cell (decision E-337).

[static] double QcPistonMover::pushDistance(const QcAabb &body, const QList<QcBlockPos> &cells, QcBlockFace towards)

Returns how far body (a world box) must move along towards to leave cells; 0 when it touches none.

Member Variable Documentation

const double QcPistonMover::pushGap

Room left between a pushed body and the block that pushed it.