QtCraft API C++ classes QML types Handbook

QcGameModes::Rules Struct

struct QcGameModes::Rules

What a mode changes about the rules. More...

Header: #include <common/gameplay/QcGameMode.h>

Public Functions

QcMovement movement() const

Public Variables

bool buildByAllowList
bool hungerFrozen
bool infiniteItems
bool instantBreak
bool interacts
bool invulnerable
bool itemCatalogue
bool mayFly
bool noClip
bool tangible

Detailed Description

Server and client derive everything from the mode, so the protocol carries only the mode itself.

Member Function Documentation

QcMovement Rules::movement() const

Returns how the rules let a player move.

Member Variable Documentation

bool Rules::buildByAllowList

Blocks break and items act on blocks only where the world's adventure allow-lists permit it (QcAdventureRules::permits); using blocks, creatures and items in the air stays as in survival.

bool Rules::hungerFrozen

Food points and exhaustion stay as they are.

bool Rules::infiniteItems

Placing a block or using an item does not use up the held stack.

bool Rules::instantBreak

Blocks break with the first strike, also unbreakable ones, and drop nothing.

bool Rules::interacts

The player's own actions: breaks, places and uses blocks and items, attacks, trades, opens screens, picks up items and changes the inventory; without it the player only looks (spectator). Commands are no such action: they stay an operator's privilege in every mode.

bool Rules::invulnerable

No damage except /kill; creatures do not target the player.

bool Rules::itemCatalogue

Items can be taken from the catalogue of all items (QcMsg::CreativeItem).

bool Rules::mayFly

Double-tapping jump toggles flight (shared physics, QcEntityMotion::stepPlayer).

bool Rules::noClip

Flies through blocks all the time (decision E-730): no collision, gravity, liquids or ladders, the speed set with the mouse wheel (QcPlayerInput::flySpeed).

bool Rules::tangible

The body is in the world: other players see it, creatures notice it, projectiles, minecarts and placed blocks meet it, it picks up nothing without it and the void hurts it. Without it the player is invisible and untouchable (spectator).