QcGuardians Class
Guardians that come back to the zones of structures (decision E-591; the sand golem in the cellar of a desert temple, a renewable source of sand). More...
| Header: | #include <server/guardians/QcGuardians.h> |
Public Functions
| int | guardianCount() const |
| int | guardianCount(quint64 site) const |
| std::optional<quint64> | readyAt(quint64 site) const |
| void | tick() |
Static Public Members
| const int | attempts |
| const int | checkTicks |
| const int | reach |
Detailed Description
Every checkTicks game ticks it asks the world generator for the zones within reach of each living player (QcWorldGenerator::plannedStructureSitesNear, from its plans, never planning on the tick thread: around a player whose regions are not all planned yet they are planned on a generation thread and the zones come with a later check; nothing is saved) and gives a zone a guardian when all of these hold: fewer than the zone's max creatures of its kind guard it; its cooldown ran out (it starts when the zone was last full or last got one; a zone seen for the first time in a session waits half its cooldown, so reloading the world at most halves the time between two guardians); no living player is within minPlayerDistance of the zone and one is within maxPlayerDistance; every chunk of the zone is loaded; the world holds fewer than QcServerLimits::guardians guardians. The guardian comes into the first of attempts random cells of the zone that has room for its body, solid ground and block light at most the zone's maxLight (QcSpawnerRules::fits), and keeps to the zone (QcCreature::guards). Kinds a spawner may not bring forth (QcSpawnerContent::refusal) never come. The game rule mobSpawning does not matter (like spawners).
Member Function Documentation
int QcGuardians::guardianCount() const
Returns the awake and resting guardians in the world.
int QcGuardians::guardianCount(quint64 site) const
Returns the awake and resting guardians of the zone site.
std::optional<quint64> QcGuardians::readyAt(quint64 site) const
Returns the game tick from which the zone site may next get a guardian; std::nullopt before it was seen.
void QcGuardians::tick()
Checks the zones every checkTicks ticks (one tick).
Member Variable Documentation
const int QcGuardians::attempts
Random cells of the zone tried per guardian.
const int QcGuardians::checkTicks
Ticks between two checks of the zones.
const int QcGuardians::reach
How far from a player zones are looked for (the largest maxPlayerDistance a zone may have).