QtCraft API C++ classes QML types Handbook

QcFireRules Namespace

The rules of fire (decision E-392), shared by QcServerFire and the tests: where fire may stand, how readily it catches on near flammable blocks and its deterministic dice. More...

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

Classes

struct Dice
class Table
struct Traits

Variables

const int ageWithoutFuel
const int stepsPerChanceAge

Functions

bool canStay(const QcBlockAccess &world, const QcFireRules::Table &table, QcBlockPos pos)
int chanceAge(int age)
bool hasFuelNear(const QcBlockAccess &world, const QcFireRules::Table &table, QcBlockPos pos)
int igniteNear(const QcBlockAccess &world, const QcFireRules::Table &table, QcBlockPos pos)
bool withinReach(QcBlockPos origin, QcBlockPos pos, int reach)

Detailed Description

Classes

class Dice

The dice of one step of a fire: drawn from the world's seed, the fire's position and its age, not from the tick, so the same in every run, independent of the order fires take their steps in, and the same after the fire's chunk was away for a while (decision E-374). More...

class Table

The Traits of every block state of a content, indexed by block state id. More...

class Traits

What fire needs to know about a block state, looked up once per content. More...

Variable Documentation

const int QcFireRules::ageWithoutFuel

A fire without a flammable block next to it goes out once older than this (the reference's 3).

const int QcFireRules::stepsPerChanceAge

Steps a fire takes for one unit of the reference game's age (which grows by one in about three steps there).

Function Documentation

bool QcFireRules::canStay(const QcBlockAccess &world, const QcFireRules::Table &table, QcBlockPos pos)

Returns whether fire may stand at pos of world by the traits of table: a solid top face below or a flammable block next to it. Cells in chunks that are not loaded count as neither.

[constexpr] int QcFireRules::chanceAge(int age)

Returns the reference game's age (0 to 15) that the chances take, of a fire's age in steps.

bool QcFireRules::hasFuelNear(const QcBlockAccess &world, const QcFireRules::Table &table, QcBlockPos pos)

Returns whether a loaded block of world next to pos is flammable by the traits of table.

int QcFireRules::igniteNear(const QcBlockAccess &world, const QcFireRules::Table &table, QcBlockPos pos)

Returns the highest ignite (of table) of the loaded blocks of world next to pos; 0 when none of them burns.

bool QcFireRules::withinReach(QcBlockPos origin, QcBlockPos pos, int reach)

Returns whether pos lies within reach blocks of origin along every axis.