QtCraft API C++ classes QML types Handbook

QcCircuitPlan Struct

What one simultaneous step of the circuits decided (decision E-335). More...

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

Public Types

struct Opening
struct Schedule

Public Functions

void addWork(qsizetype amount)
void burnOut(QcBlockPos pos)
void fire(QcBlockPos pos)
void ignite(QcBlockPos pos)
bool isEmpty() const
void movePiston(QcPistonPlan piston)
void open(QcBlockPos pos, bool isOpen)
void playNote(QcBlockPos pos)
void schedule(QcBlockPos pos, int delay, QcSignalSchedule::Priority priority)
void write(QcBlockPos pos, QcBlockId block)

Public Variables

QList<QcBlockPos> burntOut
QList<QcBlockPos> fires
QList<QcBlockPos> ignitions
QList<QcBlockPos> notes
QList<QcCircuitPlan::Opening> openings
QList<QcPistonPlan> pistons
QList<QcCircuitPlan::Schedule> schedules
qsizetype work
QHash<QcBlockPos, QcBlockId> writes

Detailed Description

Everything is decided on the world as it was before the step and applied together afterwards, so components that react in the same step never see each other's new state and their order does not matter.

Member Function Documentation

void QcCircuitPlan::addWork(qsizetype amount)

Adds amount to the work done.

void QcCircuitPlan::burnOut(QcBlockPos pos)

Notes that the torch at pos burnt out.

void QcCircuitPlan::fire(QcBlockPos pos)

Plans the dispenser or dropper at pos to eject an item.

void QcCircuitPlan::ignite(QcBlockPos pos)

Plans the explosive at pos to be lit.

bool QcCircuitPlan::isEmpty() const

Returns whether the step decided nothing to apply.

void QcCircuitPlan::movePiston(QcPistonPlan piston)

Plans the move of piston.

void QcCircuitPlan::open(QcBlockPos pos, bool isOpen)

Plans to open (isOpen) or close the door, trapdoor or gate at pos.

void QcCircuitPlan::playNote(QcBlockPos pos)

Plans the note block at pos to play its note.

void QcCircuitPlan::schedule(QcBlockPos pos, int delay, QcSignalSchedule::Priority priority)

Plans a tick of the component at pos after delay ticks with priority.

void QcCircuitPlan::write(QcBlockPos pos, QcBlockId block)

Plans the new state block at pos (what the components decide, in the words of the plan).

Member Variable Documentation

QList<QcBlockPos> QcCircuitPlan::burntOut

Torches that just burnt out (they fizzle).

QList<QcBlockPos> QcCircuitPlan::fires

Dispensers and droppers whose delay ended: they eject an item (decision E-345).

QList<QcBlockPos> QcCircuitPlan::ignitions

Explosives that got power: they are lit (decision E-601).

QList<QcBlockPos> QcCircuitPlan::notes

Note blocks whose power rose: they play their note (decision E-767).

QList<QcCircuitPlan::Opening> QcCircuitPlan::openings

Doors, trapdoors and gates to open or close (both halves of a door follow).

QList<QcPistonPlan> QcCircuitPlan::pistons

Pistons to extend or retract.

QList<QcCircuitPlan::Schedule> QcCircuitPlan::schedules

Scheduled ticks to plan.

qsizetype QcCircuitPlan::work

Work done for the tick's budget.

QHash<QcBlockPos, QcBlockId> QcCircuitPlan::writes

New states of single blocks, at most one per cell (dust, torches, repeaters, lamps, switches).