QcMobUpkeep Namespace
Rules that keep the creatures of QcMobManager in the world or take them out: despawning and leaving blocks a creature stands in. More...
| Header: | #include <server/mobs/QcMobUpkeep.h> |
Classes
| struct | Upkeep |
Types
| enum class | Fate { Stays, Despawns, MayDespawn } |
Functions
| void | leaveBlocks(QcCreature &mob, const QcMobDefinition &definition, const QcBlockAccess &world) |
| QcMobUpkeep::Upkeep | upkeepOf(const QcCreature &mob, const QcMobDefinition &definition, const QList<QcMobManager::PlayerView> &players, bool night) |
Detailed Description
Type Documentation
enum class QcMobUpkeep::Fate
What becomes of a creature in this tick: it stays, it leaves the world, or it may leave by chance (1 in idleChance).
| Constant | Value | Description |
|---|---|---|
QcMobUpkeep::Fate::Stays | 0 | It stays. |
QcMobUpkeep::Fate::Despawns | 1 | It leaves the world. |
QcMobUpkeep::Fate::MayDespawn | 2 | It may leave by chance. |
Function Documentation
void QcMobUpkeep::leaveBlocks(QcCreature &mob, const QcMobDefinition &definition, const QcBlockAccess &world)
Moves mob, a walker of the kind definition whose body overlaps blocks of world, to the nearest clear place (QcBodyFit::clearFeet, decision E-352). With nowhere to go it stays and suffocates (QcEnvironmentDamage::applySuffocation).
QcMobUpkeep::Upkeep QcMobUpkeep::upkeepOf(const QcCreature &mob, const QcMobDefinition &definition, const QList<QcMobManager::PlayerView> &players, bool night)
Returns the fate of mob of the kind definition among players in this tick (night: whether it is night).
Only players with a body count (PlayerView::alive): spectators and the dead neither keep creatures nor drive them away, as in the original game. The idle ticks are 0 while such a player is within idleDistance or there is none, otherwise one more than before, at most idleTicks + 1. The creature leaves the world in the void (decision E-288), beyond QcMobManager::despawnDistance from every player, or as a night creature in daylight; it may leave once idle for longer than idleTicks, unless it guards a zone. Nobody is far away while nobody plays (decision E-353).