QtCraft API C++ classes QML types Handbook

QcComparatorReadings Class

What a Signal Comparator reads from a block (decision E-343): the fullness of a container or machine with the reference formula, a state property scaled to 0..15, or the fullness of a container cart on a detector rail (decision E-385), as the block's data says. More...

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

Public Functions

std::optional<int> at(QcBlockPos pos) const
std::optional<int> frameAt(QcBlockPos cell, QcBlockFace face) const

Static Public Members

int fullness(const QcContentRegistry &content, const QList<QcItemStack> &stacks)

Detailed Description

Member Function Documentation

std::optional<int> QcComparatorReadings::at(QcBlockPos pos) const

Returns the reading of the block at pos, or nothing when the block is not readable.

std::optional<int> QcComparatorReadings::frameAt(QcBlockPos cell, QcBlockFace face) const

Returns the reading of the item frame in cell on face (decision E-792): the turn of its item, 1 to 8, or 0 while it is empty; nothing without such a frame.

[static] int QcComparatorReadings::fullness(const QcContentRegistry &content, const QList<QcItemStack> &stacks)

Returns the reading of stacks by the reference formula, maxStack from content: 0 when every slot is empty, else 1 + 14 times the mean fullness of the slots (each stack's count over its item's maxStack), rounded down.