QtCraft API C++ classes QML types Handbook

QcTripwires Class

Tripwire hooks and the tripwire between them (decision E-782), as decisions of a circuit step on the world before it. More...

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

Public Functions

QcTripwires(const QcSignalPower &power, const QSet<QcBlockPos> &touched, const QcSignalSchedule &schedule)
void reactHook(QcBlockPos pos, QcCircuitPlan &plan) const
void reactWire(QcBlockPos pos, QcCircuitPlan &plan) const
void removed(QcBlockPos pos, QcBlockId before, QcCircuitPlan &plan) const
void scheduledWire(QcBlockPos pos, QcBlockId block, QcCircuitPlan &plan) const

Detailed Description

A hook hangs on the side of a block and its wire leaves it away from that block; two hooks facing each other with nothing but tripwire between them (at most the hook's wireReach cells) form a line: both hooks and every wire of it are attached, and both hooks are powered while any wire of the line is. A wire is powered while something touches it and released when nothing has for its pulseTicks. Breaking an attached wire that shears did not disarm sets its hooks off for their pulseTicks before they see the broken line.

Member Function Documentation

QcTripwires::QcTripwires(const QcSignalPower &power, const QSet<QcBlockPos> &touched, const QcSignalSchedule &schedule)

power: the view of the world; touched: the wires something touches in this tick; schedule: the scheduled ticks, where a hook set off by a torn wire waits for the end of its pulse.

void QcTripwires::reactHook(QcBlockPos pos, QcCircuitPlan &plan) const

A block changed at or next to the hook at pos: its line again, into plan.

void QcTripwires::reactWire(QcBlockPos pos, QcCircuitPlan &plan) const

A block changed at or next to the wire at pos: the lines of the hooks it lies between, into plan.

void QcTripwires::removed(QcBlockPos pos, QcBlockId before, QcCircuitPlan &plan) const

The hook or wire before at pos is gone: the lines it belonged to again, into plan.

void QcTripwires::scheduledWire(QcBlockPos pos, QcBlockId block, QcCircuitPlan &plan) const

The scheduled tick of the wire block at pos: released unless something still touches it; the decisions go into plan.