QtCraft API C++ classes QML types Handbook

QcHangingRules Namespace

Where item frames and paintings may hang (decisions E-790, E-791): on solid blocks, in cells without collision or liquid, not over another frame or painting on the same face. More...

Header: #include <server/hanging/QcHangingRules.h>

Functions

bool fits(const QcBlockAccess &world, const QcHangingManager &hangings, const QcHanging &hanging)
std::optional<bool> holds(const QcBlockAccess &world, const QcHanging &hanging)
bool overlaps(const QcHangingManager &hangings, const QcHanging &hanging)
std::optional<QcHanging> painting(const QcBlockAccess &world, const QcHangingManager &hangings, const QcHangingDefinition &definition, const QcHanging &placed, QRandomGenerator &random)

Detailed Description

Function Documentation

bool QcHangingRules::fits(const QcBlockAccess &world, const QcHangingManager &hangings, const QcHanging &hanging)

Returns whether hanging may be placed in world among hangings: it holds and no other frame or painting covers one of its cells on its face.

std::optional<bool> QcHangingRules::holds(const QcBlockAccess &world, const QcHanging &hanging)

Returns whether hanging holds where it is in world: every cell free and every block behind it solid; nothing while one of these blocks is not loaded.

bool QcHangingRules::overlaps(const QcHangingManager &hangings, const QcHanging &hanging)

Returns whether another frame or painting of hangings covers one of the cells of hanging on its face.

std::optional<QcHanging> QcHangingRules::painting(const QcBlockAccess &world, const QcHangingManager &hangings, const QcHangingDefinition &definition, const QcHanging &placed, QRandomGenerator &random)

Returns the painting placed against face of a block, in front of it in cell: a random one (drawn from random) of the largest motifs of definition that fit in world among hangings, centred on cell (a motif of even width or height reaches one block further to the right or up); nothing when none fits.