QtCraft API C++ classes QML types Handbook

QcServerFire Class

Fire in the server tick (decision E-392). More...

Header: #include <server/blocks/QcServerFire.h>

Public Types

struct Numbers
Light
RainCheck

Public Functions

bool ignite(QcBlockPos pos, std::optional<QcBlockId> fire = std::nullopt)
const QcServerFire::Numbers &numbers() const
void setLight(QcServerFire::Light light)
void setRainCheck(QcServerFire::RainCheck check)
bool spreads() const
const QcFireRules::Table &table() const
void tick()

Detailed Description

The fires due in QcFireQueue take a step each, at most QcServerLimits::fireStepsPerTick (the rest waits for the next tick): a fire that can no longer stand goes out, an eternal one (on a block with "eternalFire", outside the caps, decision E-394) only waits for its next step; any other fire ages by one and goes out at QcFireQueue::maxAge, or earlier without a flammable block next to it. While fire spreads (game rule fireSpread and limit fireSpreadRadius above 0), a step may burn away the flammable blocks next to the fire (they become fire or air) and light the air around it next to flammable blocks; only in loaded chunks, within fireSpreadRadius of the spark the fire came from, and while the chunk and the world have room for more fires. New fires start with the age of the fire that lit them, so a line of fires ends after QcFireQueue::maxAge steps whatever it finds. Rain (setRainCheck, decision E-396) puts out the fires it falls on, by a chance per step, and no new fire catches where it falls.

Member Type Documentation

[alias] QcServerFire::Light

Lights the explosive at a position (QcServerExplosions::light); false when there is none.

[alias] QcServerFire::RainCheck

Whether rain falls on a position (weather, decision E-396); in each step of a fire it falls on, rain puts the fire out with a chance that grows with the fire's age (eternal fires excepted).

Member Function Documentation

bool QcServerFire::ignite(QcBlockPos pos, std::optional<QcBlockId> fire = std::nullopt)

Lights fire (the content's default fire when unset) at pos as a new spark: only in air of a loaded chunk where fire may stand and while there is room. For ignition sources. Returns whether it lit.

const QcServerFire::Numbers &QcServerFire::numbers() const

Returns the counts since the server started.

void QcServerFire::setLight(QcServerFire::Light light)

Sets light, which lights a flammable explosive that a fire would burn away instead.

void QcServerFire::setRainCheck(QcServerFire::RainCheck check)

Sets the check of where rain falls.

bool QcServerFire::spreads() const

Returns whether fire spreads now: the game rule fireSpread and a fireSpreadRadius above 0.

const QcFireRules::Table &QcServerFire::table() const

Returns the fire traits of the content's block states.

void QcServerFire::tick()

Adopts the fire blocks set without an entry, then runs the due steps within the budget.