QtCraft API C++ classes QML types Handbook

QcSlabRules Namespace

Two slabs in one cell make a full block. More...

Header: #include <common/blockrules/QcSlabRules.h>

Functions

std::optional<QcPlacedBlock> doubled(const QcBlockAccess &world, QcBlockId state, QcBlockPos clicked, QcBlockFace face, bool upper)
std::optional<QcPlacedBlock> doubledVertical(const QcBlockAccess &world, QcBlockId state, QcBlockPos clicked, QcBlockFace face, const QString &facing)
bool isVertical(const QcBlockDefinition &definition)

Detailed Description

A slab (state type: bottom, top, double) doubles up when it is clicked on its open half or placed into a slab of the other half. A vertical slab (decision E-755: "facing": "against" and the state double) stands against one side of its cell and doubles up when it is clicked on its open side or placed into a vertical slab facing the other way.

Function Documentation

std::optional<QcPlacedBlock> QcSlabRules::doubled(const QcBlockAccess &world, QcBlockId state, QcBlockPos clicked, QcBlockFace face, bool upper)

Returns the double slab that placing the slab state against face of clicked in world makes, std::nullopt when it makes none; upper is the half the click aimed at.

std::optional<QcPlacedBlock> QcSlabRules::doubledVertical(const QcBlockAccess &world, QcBlockId state, QcBlockPos clicked, QcBlockFace face, const QString &facing)

Returns the same for the vertical slab state that would face facing where it is placed, placed against face of clicked in world.

bool QcSlabRules::isVertical(const QcBlockDefinition &definition)

Returns whether the block of definition is a vertical slab.