QcMobBreeding Class
Breeding of peaceful animals (decision E-293), on the timers of QcCreature. More...
| Header: | #include <server/animals/QcMobBreeding.h> |
Public Types
Public Functions
| QcMobBreeding::Fed | feed(QcCreature &mob, const QString &item) const |
| bool | roomFor(const QList<QcCreature> &mobs, QcCreatureKindId type, const QcVec3 &position) const |
| void | setLimits(qint64 crowd, qint64 bredPerKind) |
| QList<QcMobBreeding::Birth> | tick(const QcBlockAccess &world, QcMobManager &mobs, double dt) const |
| bool | wouldEat(const QcCreature &mob, const QString &item) const |
Static Public Members
| const double | courtshipSeconds |
| const int | crowdLimit |
| const double | feedGrowUpShare |
| const int | maxBredPerKind |
Detailed Description
An adult fed with one of its breeding.food falls in love (unless it is in love already or still resting after breeding); two awake animals of a kind in love within partnerDistance that see each other get a young one at the feet of one of them and rest for cooldownSeconds. Feeding a young one brings it closer to growing up. Timers only run while the animal is awake (its chunk loaded).
Member Type Documentation
enum class QcMobBreeding::Fed
What feeding did (feed()).
| Constant | Value | Description |
|---|---|---|
QcMobBreeding::Fed::No | 0 | It does not eat that now. |
QcMobBreeding::Fed::Love | 1 | It is in love. |
QcMobBreeding::Fed::Young | 2 | A young one grew up a little. |
Member Function Documentation
QcMobBreeding::Fed QcMobBreeding::feed(QcCreature &mob, const QString &item) const
Feeds mob with the item named item; returns what happened (No: it does not eat that now).
bool QcMobBreeding::roomFor(const QList<QcCreature> &mobs, QcCreatureKindId type, const QcVec3 &position) const
Returns whether another young one of type may be born at position among mobs.
void QcMobBreeding::setLimits(qint64 crowd, qint64 bredPerKind)
Sets the bounds of breeding: crowd animals around the birth place and bredPerKind bred ones of a kind in the world.
QList<QcMobBreeding::Birth> QcMobBreeding::tick(const QcBlockAccess &world, QcMobManager &mobs, double dt) const
Advances the timers of mobs by dt seconds and pairs animals in love (the crowd around the birth place read from world); returns the young ones to spawn.
bool QcMobBreeding::wouldEat(const QcCreature &mob, const QString &item) const
Returns whether mob would eat the item named item now (in love or growing up).
Member Variable Documentation
const double QcMobBreeding::courtshipSeconds
Seconds an animal is in love before it pairs (others see it in love first).
const double QcMobBreeding::feedGrowUpShare
Share of the time to grow up that feeding a young one takes off.