QtCraft API C++ classes QML types Handbook

QcSpectatorRules Namespace

What the server holds a spectator to (decision E-730) beyond the rules of the shared physics and the body that others do not see (QcServerClient::hasBody): which of the player's requests are dropped, and where a player who stops flying through blocks comes out. More...

Header: #include <server/gameplay/QcSpectatorRules.h>

Functions

bool allows(const QcServerClient &client, const QcMessage &message)
std::optional<QcVec3> freePlaceAbove(const QcBlockAccess &world, const QcVec3 &feet)

Detailed Description

Function Documentation

bool QcSpectatorRules::allows(const QcServerClient &client, const QcMessage &message)

Returns whether the server carries out message from client: a player whose mode does not interact (QcGameModes::Rules::interacts) sends nothing that touches the world or the inventory (mining, using, attacking, trading, crafting, moving, dropping, throwing, catalogue items, picking blocks). Moving, looking, chat, choosing a hotbar slot and closing screens stay.

std::optional<QcVec3> QcSpectatorRules::freePlaceAbove(const QcBlockAccess &world, const QcVec3 &feet)

Returns where a player whose body is stuck inside the blocks of world after leaving spectator mode comes out: the lowest place straight above feet where the body touches no block, within the world's height; the feet themselves when the body is free already; none when the column has no room (the player stays where they are).