QtCraft API C++ classes QML types Handbook

QcDispenserActions Class

What Signal Dispensers and droppers do when their delay ends (decision E-345). More...

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

Public Types

EquipPlayer
Ignite

Public Functions

qsizetype fire(const QList<QcBlockPos> &positions)
void setEquipPlayer(QcDispenserActions::EquipPlayer equip)
void setIgnite(QcDispenserActions::Ignite ignite)

Static Public Members

const double shotOffset
const double shotSpeed
const double throwLift
const double throwSpeed

Detailed Description

Each picks one of its non-empty slots at random, from a generator seeded with the world's seed, the tick and its contents (so the same world plays the same, wherever and however the dispenser stands). A dropper facing a container puts the item into it like a hopper (all droppers of a step together, QcInventoryAccess::resolve), otherwise it throws it. A dispenser uses the item by its dispense action from the data (pour or take a liquid, put armour on a player or armour stand in front, light fire in front with flint and steel, shoot ammunition as its projectile, decision E-621) and throws it out when the action fails (flint and steel stays) or the item has none, also in front of a container. Seeds are thrown, never planted: they plant themselves on farmland (decision E-294). Actions of one step that need the same cell all fail (no order decides).

Member Type Documentation

[alias] QcDispenserActions::EquipPlayer

Puts the new equipment on a player.

[alias] QcDispenserActions::Ignite

Lights fire at a position like flint and steel (QcFireIgnition::strike); false when nothing caught.

Member Function Documentation

qsizetype QcDispenserActions::fire(const QList<QcBlockPos> &positions)

Fires the dispensers at positions together; returns the work done.

void QcDispenserActions::setEquipPlayer(QcDispenserActions::EquipPlayer equip)

Sets equip, called with the player and the new equipment when a dispenser puts armour on a player.

void QcDispenserActions::setIgnite(QcDispenserActions::Ignite ignite)

Sets ignite, with which a dispenser lights fire with flint and steel.