QtCraft API C++ classes QML types Handbook

QcMobLaying Class

Creatures laying now and then (a chicken's eggs, decision E-452), on QcCreature::layTimer: an awake adult of a kind with QcMobDefinition::laying counts its time down and lays when it runs out, then chooses the next time evenly between the kind's minSeconds and maxSeconds. More...

Header: #include <server/animals/QcMobLaying.h>

Public Types

struct Laid

Static Public Members

double nextTime(const QcLayingDefinition &laying, QRandomGenerator &random)
QList<QcMobLaying::Laid> tick(const QcContentRegistry &content, QList<QcCreature> &mobs, QRandomGenerator &random, double dt)

Detailed Description

Young ones and dormant creatures (their chunk not simulated) do not count.

Member Function Documentation

[static] double QcMobLaying::nextTime(const QcLayingDefinition &laying, QRandomGenerator &random)

Returns a time until the next laying of laying, drawn from random evenly between its minSeconds and maxSeconds.

[static] QList<QcMobLaying::Laid> QcMobLaying::tick(const QcContentRegistry &content, QList<QcCreature> &mobs, QRandomGenerator &random, double dt)

Advances the timers of mobs by dt seconds (kinds from content, new times drawn from random); returns what was laid.