QtCraft API C++ classes QML types Handbook

QcEnvironmentDamage Class

What the world does to bodies by itself (decision E-367): blocks with contact damage (lava, fire, magma) hurt players and creatures and burn items, and players and creatures with their eyes in a full solid block suffocate. More...

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

Public Functions

void applyContactDamage()
void applySuffocation()

Static Public Members

const int contactIntervalTicks
QcVec3 eyesOf(const QcCreature &mob, const QcMobDefinition &definition)
const double suffocationDamage
const int suffocationIntervalTicks

Detailed Description

The void is QcPlayerHealth's (it has its own rhythm, E-288).

Member Function Documentation

void QcEnvironmentDamage::applyContactDamage()

Players and creatures touching a damaging block get hurt; items in it burn.

void QcEnvironmentDamage::applySuffocation()

Players and creatures with their eyes inside a full solid block suffocate.

[static] QcVec3 QcEnvironmentDamage::eyesOf(const QcCreature &mob, const QcMobDefinition &definition)

Returns where the eyes of mob of definition are: a standing share of its height above its feet; a villager lying in its bed (decision E-411) has them in the middle of its lying box, inside the bed's cells, so a bed under a low roof does not suffocate it (decision E-415).

Member Variable Documentation

const int QcEnvironmentDamage::contactIntervalTicks

A body touching a damaging block is hurt once every this many ticks, spread over the ticks by its id, as the reference's lava and cactus are with its default invulnerability. The rhythm is its own, so the game rules playerInvulnerabilityTicks and mobInvulnerabilityTicks govern only how a hit takes (decision E-429), not how often lava strikes.